Toggle Statechanges to Tokenpoperty Changes?

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
GothFox
Kobold
Posts: 8
Joined: Mon Feb 16, 2015 9:20 am

Toggle Statechanges to Tokenpoperty Changes?

Post by GothFox »

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. :D

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.

GothFox
Kobold
Posts: 8
Joined: Mon Feb 16, 2015 9:20 am

Re: Toggle Statechanges to Tokenpoperty Changes?

Post by GothFox »

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.


GothFox
Kobold
Posts: 8
Joined: Mon Feb 16, 2015 9:20 am

Re: Toggle Statechanges to Tokenpoperty Changes?

Post by GothFox »

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.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Toggle Statechanges to Tokenpoperty Changes?

Post by aliasmask »

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:

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}]
It should look more like this:

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]
}]
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.


GothFox
Kobold
Posts: 8
Joined: Mon Feb 16, 2015 9:20 am

Re: Toggle Statechanges to Tokenpoperty Changes?

Post by GothFox »

Now it works!
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]
}]

Post Reply

Return to “Macros”