Call Macros

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Call Macros

Post by feleas »

I'm trying to make it so I can call the value of my "Weapon" macro into any of my spell macros, however I have no clue how to make it work. to give you some backstory as to what I'm doing this is because I'm in a D&D 4.0 campaign and my character is a valorous bard, so all my At-Will spells use my weapon profile to deal their damage plus my charisma modifier.

So my question is: how do I make this work?

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Call Macros

Post by CoveredInFish »

To begin ... have you read the Calling macros article?

feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

I have, but I feel it's not explaining something that I'm missing. I've done programming in college and understand call methods, but for some reason it's done in a way in maptools that I'm not quite understanding. I think it's the whole library token thing that's losing me. I mean where do I put in the macro I wanna call in the library token? It's not explained.

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Call Macros

Post by Bone White »

A Library token is a token with the name in the format: "Lib:NameOfLibToken"

Calling a "value of my 'weapon' " is not a macro call, but a variable call. Therefore what you are looking for is Wiki: getProperty() or Wiki: getLibProperty().

feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

That brings my next question. What is this default token? The one you have selected?

Also, this is the error I'm getting:

Error in body of roll.
Statement options (if any): r       
Statement Body : getProperty("Description")

feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

Ok I made it so I can get a property from the token. BUT, what I'm trying to get is a dice roll value, and the getProperty is reading the roll as a string and not as a method.

feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

Yeah, the more I look at this getProperty method, the more I'm thinking you misunderstood. I'm looking to get a dice roll in, not a specific value off of a token.

feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

my biggest issue I noticed I'm having that seems to be failed to be explained in the links provided is, how do I put a macro inside the library token. What block do I put it in? What format is it written? How do I name it within the block? These are the answers I want.

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Call Macros

Post by Bone White »

Yet again, getting a "dice roll value" does not require a macro call, just a line in your existing macro, probably using Wiki: roll().

As for making a macro on any token

Open the selected window in MapTool.
Left Click the token you wish to create a macro on.
Right click in the selected window, and choose New...
Name your macro and write it here.

========

Glossary:

Macro Call calling a macro from within another macro. I click macro a, which calls macro b inside it, which means I do not have to click macro b after macro a.
Calling a variable getting the value of a variable which is stored somewhere, there are two types:
Calling a local variable [h: x = 5] This stores the value 5 to the local variable x. To call it, simply use x in your macro code e.g. [r: x]
Calling a token variable [h: setProperty("x",5)] This stores the value 5 to the token's property variable "x". To call it: [r: getProperty("x")] This defaults to the current token unless an optional token ID parameter is supplied.
Current Token Defaults to the token the macro is run from. Can be changed with Wiki: switchToken() or [token:], using a token's ID.
Token ID A unique string which is assigned to every token on creation, and is used to specify which token you wish to deal with.
String A type of variable which contains any numbers or letters as text.
Variable A type of data storage where the value can be changed. MapTool does not use (for the most part) variable classes/types which makes it much easier for beginners.
"getting a dice roll value" Use Wiki: roll() and set it to a variable. Save it to a token variable using Wiki: setProperty() if you need to reference it from another macro later.

This list could really go on and on but I think you get the idea here.

=======

Summary:

You need to understand very basic terms and principles of coding before you can hope to progress any further. If you don't ask the right question, we can't give you the right answer.

feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

Haha thanks so much. That worked like a charm!

One last question and I know this is weird, but in my macro I have:

Attack Roll: [r: 1d20 + 4] <br>
Damage Roll: [r: macro.return + 4]

Which runs smoothly EXCEPT for some reason it's displaying this into the chat box:

Attack Roll: <number result>
Damage Roll:Damage Roll: <number result>

How does that even happen? haha

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Call Macros

Post by Bone White »

feleas wrote:How does that even happen?
No idea on that one sorry, though it helps if you post the relevant macros here (preferably inside

Code: Select all

 forum brackets)


feleas
Kobold
Posts: 9
Joined: Tue Jul 30, 2013 12:24 pm

Re: Call Macros

Post by feleas »

Haha that's a shame but thanks for the help still.

Post Reply

Return to “Macros”