How to use getProperty()?

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
Charlweed
Kobold
Posts: 12
Joined: Thu Apr 16, 2015 3:14 pm

How to use getProperty()?

Post by Charlweed »

I peeps, first post, first attempt at macros.
I want to use properties of my player-character token, but even the example in the wiki does not work. I copied the example from
http://www.lmwcs.com/rptools/wiki/getProperty
The value of property 'Strength' is [r: getProperty("Strength")].
but I get the error:
 

Code: Select all

  Error in body of roll.
          Statement options (if any): r
          Statement Body : getProperty("Strength")
I tried selecting the token in the map, and in the map explorer, same error.
What am I doing wrong?
Thanks!

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

Re: How to use getProperty()?

Post by aliasmask »

In order to get info from a token it must first be impersonated. There are many ways to do this, but if you were to simply put this line in to the chat it wouldn't know which token to get the info from.

You can either create a macro on the token then the default impersonation would be that token. You can check the box in the properties of the macro to set "Apply to Selected Tokens". You can put the token's id in the function. You can use Wiki: switchToken(). You can right click token and select Impersonate and use that statement in the chat.

The most common way to run macros is to create a token named "lib:_____" where ___ is the name you give it. So, lets say it was an attack library then you may put lib:attack. One you have your macro written in your lib:token it's best to call it from a globally shared location like the Campaign Window. There are a couple of ways to do it, but I recommend using user defined functions. The most common way for beginners is to use [macro:].

I have a programmers starter kit here: http://forums.rptools.net/viewtopic.php ... 31#p255459

Charlweed
Kobold
Posts: 12
Joined: Thu Apr 16, 2015 3:14 pm

Re: How to use getProperty()?

Post by Charlweed »

Thank you!
Simply using "Add New Macro" and running from there was enough to get me started. I'll download your kit and have a look through it.

Post Reply

Return to “Macros”