Need help with a macro for adding states to a token.
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Need help with a macro for adding states to a token.
Could someone help me create this macro:
Window appears with radial buttons numbered 1-10 (so 10 radial buttons). Depending on which radial button is selected, a corresponding state image appears on the token. Assume each state is named; A1, A2, A3, etc, etc to match up with the radial button numbers. So selecting radial button 1 causes state image A1 to appear on the token. Also, regardless of what radial button is clicked, another state image will also appear on the token. This image could be called X1. So using this macro causes 2 images at once to appear on the token.
If I use the macro again on the same token, the previously selected radial button will be selected. Selecting a different radial button will change the state image on the token.
Finally, above the radial buttons would be some sort of ability to select an "End Status" function that will clear the states associated with this macro but not any other states currently on the token. This could be another radial button, or a new button that when pressed, closes the window and removes the states for this macro.
Is this possible? Thanks!
Window appears with radial buttons numbered 1-10 (so 10 radial buttons). Depending on which radial button is selected, a corresponding state image appears on the token. Assume each state is named; A1, A2, A3, etc, etc to match up with the radial button numbers. So selecting radial button 1 causes state image A1 to appear on the token. Also, regardless of what radial button is clicked, another state image will also appear on the token. This image could be called X1. So using this macro causes 2 images at once to appear on the token.
If I use the macro again on the same token, the previously selected radial button will be selected. Selecting a different radial button will change the state image on the token.
Finally, above the radial buttons would be some sort of ability to select an "End Status" function that will clear the states associated with this macro but not any other states currently on the token. This could be another radial button, or a new button that when pressed, closes the window and removes the states for this macro.
Is this possible? Thanks!
Re: Need help with a macro for adding states to a token.
roughly something like this:
UNTESTED!!
edited!
Code: Select all
[assert(listCount(getSelectedNames())==1, "Make sure only one token is selected",0)]
[switchToken(getSelectedNames())]
[oldNumberState = 0]
[count(11),if(getState("A"+roll.count)):oldNumberState = roll.count]
[abort(input("numberState|none,1,2,3,4,5,6,7,8,9,10|Which Number State|RADIO|ORIENT=V SELECT="+oldNumberState))]
[count(11):setState("A"+roll.count,0)]
[if(numberState), CODE:{
[setState("A"+numberState,1)]
[setState("X1",1)]
};{
[setState("X1",0)]
}]
edited!
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: Need help with a macro for adding states to a token.
So I get this message:wolph42 wrote:UNTESTED!!
Code: Select all
Invalid condition in IF(getState("A"+roll.count)) roll option. Statement options (if any): count(11),if(getState("A"+roll.count)) Statement Body : oldNumberState = roll.count
Re: Need help with a macro for adding states to a token.
I think you need to create an a0 as well for it to work. If a state does not exist and you check for it it renders an error, which is passed on to the if statement
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: Need help with a macro for adding states to a token.
That did it. However, the previous "A" states are not replaced when the macro is used again. The states stack on top of each other. Using the "none" button removes them, but only one at a time. So I need to keep using the macro to remove them.
This text also appears in the chat window in case it is a separate issue:
This text also appears in the chat window in case it is a separate issue:
Code: Select all
« assert(listCount(getSelectedNames())==1, "Make sure only one token is selected",0) = 1 » « switchToken(getSelectedNames()) = switchToken(getSelectedNames()) = » « oldNumberState = 0 = oldNumberState = 0 = 0 » « '' = '' = », « oldNumberState = roll.count = oldNumberState = 1 = 1 », « '' = '' = », « '' = '' = », « '' = '' = », « '' = '' = », « '' = '' = », « '' = '' = », « '' = '' = », « '' = '' = », « '' = '' = » « abort(input("numberState|none,1,2,3,4,5,6,7,8,9,10|Which Number State|RADIO|ORIENT=V SELECT="+oldNumberState)) = abort(input("numberState|none,1,2,3,4,5,6,7,8,9,10|Which Number State|RADIO|ORIENT=V SELECT=" + 1)) = 1 » « setState("A"+numberState,1) = setState("A" + 2, 1) = 1 » « setState("X1",1) = setState("X1", 1) = 1 »
Re: Need help with a macro for adding states to a token.
Need to think about the former(note that you can use am's choose from the other post to turn the states off. As for the latter either
Put h: in [h:
Or bluntly insert abort(0) at the end
Put h: in [h:
Or bluntly insert abort(0) at the end
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: Need help with a macro for adding states to a token.
Updated earlier post with correct code. Should work now. You still need to add the h roll option though to hide the text
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: Need help with a macro for adding states to a token.
Hmm, I still get the same result (numbers not getting replaced when the macro is used again). The "none" button also doesn't clear anything any longer. The chat window reports back with "Undefined function: count".
Re: Need help with a macro for adding states to a token.
try again.
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: Need help with a macro for adding states to a token.
I got the same results as before including the "Undefined function: count" error.
Re: Need help with a macro for adding states to a token.
Syntax is a ' female dog '... Try again
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: Need help with a macro for adding states to a token.
It still does not remove the old "A" states when adding the new "A" states. Although, this time when I click on "none" it does remove X1 and all of the "A" states that are currently appearing on the token.
Do I by chance need to have an identifier somehow in the Basics token property for this to work? I'm just wondering if this macro needs to store the "A" token info in the token Basic property in order for the new "A" to replace the old "A".
Do I by chance need to have an identifier somehow in the Basics token property for this to work? I'm just wondering if this macro needs to store the "A" token info in the token Basic property in order for the new "A" to replace the old "A".
Re: Need help with a macro for adding states to a token.
you didnt say that you wanted that (at least, thats my interpretation). But...try again...
and no, thats not required.
and no, thats not required.
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: Need help with a macro for adding states to a token.
My 3rd post down mentioned the A states not being removed. Which was what I thought you were trying to get working this whole time.wolph42 wrote:you didnt say that you wanted that
Sorry if I confused you. Works perfectly now though! Thank you so much.
Re: Need help with a macro for adding states to a token.
Good to hear we finally got there!
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