Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Is it possible to Read a Page Variable from a Token Macro?

1582418548

Edited 1582418863
Ajax
Pro
I would like to be able to set a universal DC on each different Map Page, and have the character tokens be able to use that value when checking for success or failure. I don't need logic just the ability of the macro to read a value from the current page. Is this possible. Or would it be possible to place a token object on the GM Layer and have it's value read without having to click on it.
1582418736
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Pages do not store variables, unfortunately. You could set up a DC as a character attribute they could access, and change that variable when you change pages.
KeithCurtis said: Pages do not store variables, unfortunately. You could set up a DC as a character attribute they could access, and change that variable when you change pages. I don't want to have to change the value on the character every time the page would change, if there was a way to have something on each page that could hold a value that could be accessed that would be the answer.
1582419637
Kraynic
Pro
Sheet Author
Well, you could set up a character and make a variable for each page, but then you need a much more complex macro set up to access the variables.  If it is just one variable that you set each time you change maps, the macros are much easier to deal with. 
1582420246
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If you set the variable in Bar 1 of a token (linked to the sheet as mentioned above), and kept that token on each map page, it would allow you to change it fairly rapidly. However, what you are asking for cannot be done with regular tools. It might be possible with a custom API script.
I figured out a work around, thanks for your suggestions.
1582475702
GiGs
Pro
Sheet Author
API Scripter
Care to share the workaround, in case others have a similar problem?
System I am using for this, uses the bar2 to hold that variable, normally this is used for AC however in the system I use for this Armor Stops Damage, so that is simply a Character Attribute. Now it is still kind of a pain because you have to set the bar2 value each time the variable changes, but that is still a simple quick click on the token to change it. Works on PCs and NPCs and Creatures as long as the bar2 is used for that variable. Ideally it would be nice to have a few variables set on the page itself that could be read by a macro, might be something the DEVs could consider, or someone could write a script to do it.
1582517823
The Aaron
Roll20 Production Team
API Scripter
A script couldn't add attributes to pages as pages don't have a place to put them.  There might be other solutions though, if you could share a bit more detail about your use case. For example, a script could proactively set an attribute on a character named "PlayerPages" that has some value for each player based on what page a player is on.
The easiest way to use it would be a token on the GM Layer that could carry the value in one of the bars. The application I want use this in is for a Universal DC for each particular page. When Rolling for Checks Players would be rolling against that Universal DC, which would compared to the Dice Roll Results. The object of this would be being able to place something on a page that could hold a variable, that a player's macro could read for comparison. Whew!