Hi!
I am trying to write a macro, that toggles statechanges to tokenproperty Changes.
One of my PCs wants to use the Feat Rage.
I am despairing, so I ask for help. This is the rest, what remains wehen I got frustrated and deleted all the crap I wrote in the last few hours.
If the player enters ragemode, the Tokenproperties should be updatet in the Property sheet. When he leaves Rage Mode, she old properties should be restored.
[h: ragewilll = getProperty(Wille)+2]
[h: oldwill = getProperty(Wille)]
[h: newStr = getProperty(Staerke)+4]
[h: oldstr = getProperty(Staerke]
[h: newkomod = getProperty(Konstitution)+4]
[h: oldkomod = getProperty(Konstitution)]
[h: newRK = getProperty(Ruestung)-2]
[h: oldRK = getProperty(Ruestung)]
[h,if(getState("Rage")): setState("Rage", 0); setState("Rage", 1)] <---- this works.
Toggle Statechanges to Tokenpoperty Changes?
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Toggle Statechanges to Tokenpoperty Changes?
Next Try:
[h: ragewilll = Wille+2]
[h: oldwill= Wille]
[h: newstmod= StMod+2]
[h: oldstmod=StMod]
[h: newkomod=KoMod+2]
[h: oldkomod=KoMod]
[h: newRK= Ruestung-2]
[h: okdRK= Ruestung]
[h,if(getState("Rage")): setState("Rage", 0); setState("Rage", 1)]
[h,if("Rage"== 1): {Wille=ragewill}, {StMod=newstmod},{KoMod=newkomod},{Ruestung=newRK}]
[h,if("Rage"== 0): {Wille=oldwill}, {StMod=oldstmod},{KoMod=oldkomod},{Ruestung=oldRK}]
In this version, I dont get any error Messages, the statechange works, but the tokenproperties art untouched.
[h: ragewilll = Wille+2]
[h: oldwill= Wille]
[h: newstmod= StMod+2]
[h: oldstmod=StMod]
[h: newkomod=KoMod+2]
[h: oldkomod=KoMod]
[h: newRK= Ruestung-2]
[h: okdRK= Ruestung]
[h,if(getState("Rage")): setState("Rage", 0); setState("Rage", 1)]
[h,if("Rage"== 1): {Wille=ragewill}, {StMod=newstmod},{KoMod=newkomod},{Ruestung=newRK}]
[h,if("Rage"== 0): {Wille=oldwill}, {StMod=oldstmod},{KoMod=oldkomod},{Ruestung=oldRK}]
In this version, I dont get any error Messages, the statechange works, but the tokenproperties art untouched.
Re: Toggle Statechanges to Tokenpoperty Changes?
apparently you need to set them. is the token in context? eg by use of Wiki: switchToken()
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: Toggle Statechanges to Tokenpoperty Changes?
The tokenproperties are set.
What means "Token in Context?" and how to use switchToken()?
Sorry, I am a noob in macro writing, I am trying to learn this since about two weeks, reading all tutorials, tipps & examples.
What means "Token in Context?" and how to use switchToken()?
Sorry, I am a noob in macro writing, I am trying to learn this since about two weeks, reading all tutorials, tipps & examples.
Re: Toggle Statechanges to Tokenpoperty Changes?
He means impersonated which is a fancy way of saying default token selected. There are many ways to do this including setting the impersonated token with Wiki: switchToken().
As for token properties not being changed, this makes my eyes bleed:
It should look more like this:
I can't say how well your logic will work out not seeing the rest of your code but I'm assuming oldwill and those related variables are token properties which store the will before being changed by another source like rage. Or at least it should be.
As for token properties not being changed, this makes my eyes bleed:
Code: Select all
[h,if("Rage"== 1): {Wille=ragewill}, {StMod=newstmod},{KoMod=newkomod},{Ruestung=newRK}]
[h,if("Rage"== 0): {Wille=oldwill}, {StMod=oldstmod},{KoMod=oldkomod},{Ruestung=oldRK}]
Code: Select all
[h,if(state.Rage == 1), code:{
[Wille=ragewill]
[StMod=newstmod]
[KoMod=newkomod]
[Ruestung=newRK]
};{
[Wille=oldwill]
[StMod=oldstmod]
[KoMod=oldkomod]
[Ruestung=oldRK]
}]
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Toggle Statechanges to Tokenpoperty Changes?
always subtle...this makes my eyes bleed
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: Toggle Statechanges to Tokenpoperty Changes?
Now it works!
Tank you for the help.^^
The complete macro looks like this:
Tank you for the help.^^
The complete macro looks like this:
Code: Select all
[h,if(getState("Rage")): setState("Rage", 0); setState("Rage", 1)]
[h,if(state.Rage == 1), code:{
[Wille=Wille+2]
[Staerke=Staerke+4]
[Konstitution=Konstitution+4]
[Ruestung=Ruestung-2]
};{
[Wille=Wille-2]
[Staerke=Staerke-4]
[Konstitution=Konstitution+4]
[Ruestung=Ruestung-2]
}]