Call Macros
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Call Macros
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?
So my question is: how do I make this work?
- CoveredInFish
- Demigod
- Posts: 3104
- Joined: Mon Jun 29, 2009 10:37 am
- Location: Germany
- Contact:
Re: Call Macros
To begin ... have you read the Calling macros article?
Re: Call Macros
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.
- Bone White
- Great Wyrm
- Posts: 1124
- Joined: Tue Aug 23, 2011 11:41 am
- Location: Cornwall, UK
Re: Call Macros
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().
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().
Re: Call Macros
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")
Also, this is the error I'm getting:
Error in body of roll.
Statement options (if any): r
Statement Body : getProperty("Description")
Re: Call Macros
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.
Re: Call Macros
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.
Re: Call Macros
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.
- Bone White
- Great Wyrm
- Posts: 1124
- Joined: Tue Aug 23, 2011 11:41 am
- Location: Cornwall, UK
Re: Call Macros
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.
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.
Re: Call Macros
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
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
- Bone White
- Great Wyrm
- Posts: 1124
- Joined: Tue Aug 23, 2011 11:41 am
- Location: Cornwall, UK
Re: Call Macros
No idea on that one sorry, though it helps if you post the relevant macros here (preferably insidefeleas wrote:How does that even happen?
Code: Select all
forum brackets)
Re: Call Macros
Looks like the smiley bug. Either get b90 or turn off smilies in the settings
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Call Macros
Haha that's a shame but thanks for the help still.