SetProperty, what am I doing wrong?

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
Adurna
Cave Troll
Posts: 34
Joined: Thu Jul 07, 2016 7:45 am

SetProperty, what am I doing wrong?

Post by Adurna »

Hi!

I'm trying to create a macro to change one token, like with a polymorph effect, so I need to change size and stats.

So far I managed to get it to change back and forth size and the token image, however I can't seem to have the macro set new properties.


At first I thought the macro got confused because I was trying with something like

Code: Select all

getproperty(Str, tokenX)
setproperty(Str, Str)

so I changed, and decided to create a library token and store the new form properties there.

But still, I can access the property, because when I tested the macro was able to output them, but I can't manage to actually change it.

Code: Select all

[h: setSize("Large")]

[h: getImage('Image:Bezekira')]

[h: setTokenImage("Image:Bezekira")]


[h: getLibProperty("NewStr", "Lib:Bezekira")]
[r: getLibProperty("NewStr", "Lib:Bezekira")]

[h: setProperty(Str, "NewStr")]
This is what I have so far, except the set property doesn't seem to work. The thing is, I'm not getting an error or anything so I really don't know what's wrong.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: SetProperty, what am I doing wrong?

Post by Full Bleed »

Adurna wrote:This is what I have so far, except the set property doesn't seem to work. The thing is, I'm not getting an error or anything so I really don't know what's wrong.
One thing is that the property you're setting needs to be in quotes.

From the Wiki: setProperty() wiki:

Code: Select all

[h: setProperty("Health", 10)]
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Adurna
Cave Troll
Posts: 34
Joined: Thu Jul 07, 2016 7:45 am

Re: SetProperty, what am I doing wrong?

Post by Adurna »

Uh, right.

However, still not working with the quotes :(

Tho at least now there is an error, so yay!

Code: Select all

[h: setSize("Large")]

[h: getImage('Image:Bezekira')]

[h: setTokenImage("Image:Bezekira")]


[h: getLibProperty("NewStr", "Lib:Bezekira")]
[r: getLibProperty("NewStr", "Lib:Bezekira")]



[h: setProperty("Str", NewStr)]



It now asks a value for NewStr. :evil:

If I do put quotes around NewStr the property does change, to NewStr. As in the letters and not the number. So it works except it doesn't understand NewStr is that little number it got from getlibproperty.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: SetProperty, what am I doing wrong?

Post by Full Bleed »

Adurna wrote: It now asks a value for NewStr. :evil:
Because you've not set the value.

You need to:

Code: Select all

[h: newStr = getLibProperty("NewStr", "Lib:Bezekira")]
[h: setProperty("Str", newStr)] 
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Adurna
Cave Troll
Posts: 34
Joined: Thu Jul 07, 2016 7:45 am

Re: SetProperty, what am I doing wrong?

Post by Adurna »

It Works!

Thank you, thank you, thank you!

It wasn't clear on the wiki page that I had to do that :(

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: SetProperty, what am I doing wrong?

Post by Full Bleed »

Adurna wrote:It wasn't clear on the wiki page that I had to do that :(
Yeah... there could certainly be better examples on that page.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Post Reply

Return to “Macros”