!token-mod --set bar1_max|20It's only auto-calculating that 20 that it can't do.
!setattr --sel --HPbar_Wound|0 !token-mod --set bar1_link| bar2_link| bar3_link| bar1| bar2| bar3| !token-mod {{ --set bar3|@{selected|HP} --set bar2|@{selected|Armor_Value} --set bar2_max| --set name|'@{selected|character_name} %%NUMBERED%%' --on showname --on showplayers_name --off showplayers_bar1 --off showplayers_bar2 --off showplayers_bar3 --off light_hassight --set aura1_radius|0 --set aura2_radius|0 --set defaulttoken }}
!token-mod ?{Status|Blinded, --set statusmarkers#!bleeding-eye --flip light_hassight |Slowed, --set statusmarkers#!tread}You could further separate the Blinded and Not Blinded statuses, which lets you assure that the status marker and the vision state both match by explicitly setting them rather than flipping them:
!token-mod --set ?{Adjust Status|Blinded, statusmarkers#+bleeding-eye light_hassight#off |Not Blinded,statusmarkers#-bleeding-eye light_hassight#on}but gives you a longer dropdown.
on('ready',function(){
if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){
TokenMod.ObserveTokenChange(function(obj,prev){
if(obj.get('statusmarkers') !== prev.statusmarkers){
sendChat('Observer Token Change','Token: '+obj.get('name')+' has changed status markers!');
}
});
}
});
Anthony V. said:
Is there a way to create attributes with token mod? As well as edit them?
!token-mod --set bar1|[[@{selected|npc_hpformula}]]Assuming bar1 is where you put your hit points.
on("change:graphic", function(obj) {This simply adds the big red X over any token with 0HP. - However, when I combine it with my tokenmods macro...
if(obj.get("bar1_max") === "") return;
if(obj.get("bar1_value") <= 0) {
obj.set({
status_dead: true
});
}
else {
obj.set({
status_dead: false
});
}
});
!token-mod --set bar1_value|-?{How much damage|0}The value will drop down to 0 (or even less) but the the other script won't...umm.... activate? - It's as if the other script doesn't realize that a attribute/stat has changed.
on('ready', () => { const HPBarNum = 1; const bar = `bar${HPBarNum}_value`; const max = `bar${HPBarNum}_max`; const constrainHPBarToMax = (obj) => { const hpMax = parseInt(obj.get(max),10); if(!isNaN(hpMax) && 'token' === obj.get('subtype') && !obj.get('isdrawing') ){ let hp = parseInt(obj.get(bar),10); let changes = {}; if(hp > hpMax) { hp = hpMax; changes[bar] = hp; changes.status_dead = false; } else if(hp <= 0) { hp=0; changes[bar] = hp; changes.status_dead = true; } else { changes.status_dead = false; } obj.set(changes); } }; on("change:token", constrainHPBarToMax); if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){ TokenMod.ObserveTokenChange(constrainHPBarToMax); } });
const bar = `bar${HPBarNum}_value`; const max = `bar${HPBarNum}_max`;
const bar = `bar1{HPBarNum}_value`;
const max = `bar1{HPBarNum}_max`;
const HPBarNum = 2; // now uses bar 2Those two lines you changed build the property names for the bar and it's max value for later use. The ${ variable } is the syntax for embedding the value of a variable into a Javascript Template Literal ` `.
There's a button under Experimental Features:godthedj said:
I always thought that changing the 'default' for characters only impacted on new sheets, not ones that were already made. - That said, I'd definitely believe Aaron over me!
Hi TheAaron!
You've been so helpful in the past with various issues I've been having as I'm learning Roll20, I'd figured I'd ask this question here.
I'm looking for the appropriate settings to change the tint of a token to red when raging, then back to transparent when rage ends.
I want this to not be something I control ( @{target|token_id} ), but something the player can control from their character sheet when they hit their Rage feature, and within the description, a button to end their rage (changing their tint to transparent again).
Also (see pic), I want this to be able to tick/ untick a modifier to the shaped sheet called Rage that puts the extra damage in place and removes it when not raging.
I'd suggest something like:
!token-mod --set tint_color|!rgb(1.0,0.0,0.0) --ids @{character_id}
That will toggle red tinting on and off for all tokens representing that character. You'd need to be sure the Players Can IDs setting is on for it to work, and probably provide it as a token action to let them toggle it off easily.
Here's what you can do with the ChatSetAttr script in addition to Token-mod.
!setattr --sel --repeating_modifier_-Kxv0jsJJbqVj2TOmOUx_active|1
!token-mod --set tint_color|!rgb(1.0,0.0,0.0) --ids @{character_id} %{-Kxuzh6nmVSyQctBaYDP|repeating_classfeature_-kxv-h9bt0lj8jr91h6p_action}
This will toggle the mod, as well as change the tint. The first and third lines will need to have the bold part changed in order to get the proper repeating modifier ID for your character's Rage modifier. You can find this with Chrome's inspector, and instructions are in the sheet docs. The second line is Aaron's code. The character ability I have taken this from in my own game assigns a status marker, but changing tint to red is pretty cool. The last line is optional, and is only used to decrement the uses of Rage. It is found by clicking on the class features macro button, choosing Rage, and pressing the Up arrow in chat.
To turn rage off, change the first line to end with "0" instead of "1". Keep the second line, since it toggles the tint, and omit the third line, since you have already decremented your rages.
OUTSTANDING WORK TO BOTH OF YOU!!!! Awesomeness!
keithcurtis said:
Here's what you can do with the ChatSetAttr script in addition to Token-mod.
!setattr --sel --repeating_modifier_-Kxv0jsJJbqVj2TOmOUx_active|1
!token-mod --set tint_color|!rgb(1.0,0.0,0.0) --ids @{character_id} %{-Kxuzh6nmVSyQctBaYDP|repeating_classfeature_-kxv-h9bt0lj8jr91h6p_action}This will toggle the mod, as well as change the tint. The first and third lines will need to have the bold part changed in order to get the proper repeating modifier ID for your character's Rage modifier. You can find this with Chrome's inspector, and instructions are in the sheet docs. The second line is Aaron's code. The character ability I have taken this from in my own game assigns a status marker, but changing tint to red is pretty cool. The last line is optional, and is only used to decrement the uses of Rage. It is found by clicking on the class features macro button, choosing Rage, and pressing the Up arrow in chat.
To turn rage off, change the first line to end with "0" instead of "1". Keep the second line, since it toggles the tint, and omit the third line, since you have already decremented your rages.
Ugg ... though I'm sure there is no other way than IDs to do specific actions though, is there? Something more vanilla?
If I put the macro lines in the rage description box somehow, that would cover the usage ticking and be able to omit the 3rd line. if the player clicks their rage, it decrements use and fires the code to turn it on. But that won't tick the modifier to increase damage, so I still need to use an ID for that.
Then also, to turn it off, I need a macro with identifiers.
What I was kinda looking for is if anyone in my group wants to play a barbarian, "Here's your macros, set one in the rage box, make your own macro for the other." But this is more my level of work - in finding their ID's for them to be able to do both as their own token macros.
Not vanilla. Very chocolate. Thought we had what I was looking for for a moment, and we do, it's just a lot of extra and individualized work. Maybe I'll get lucky and no one will roll a barbarian .... lmao.
Unfortunately, the only option to make it more vanilla is to ensure that all characters have their Rage mod and Rage class feature in the same order, so that you can refer to them by sequence number instead of discreet ID.
If they change it (Both Rage Class Feature and Modifier) to the first in line, will that change the way I can do this? (Looks upward with hope) I only worry that the sequence number wouldn't update on an order change.
If it does do this, what codes do I need to enter in that instance and get the code to fire on the class feature click (I know I need to make a macro to turn off the rage)? I know there will be times people just want to 'check' their feature, but it still should run irregardless.
It would likely be something like:
repeating_modifier_$0_active
Or possibly,
@{Name of the Character|repeating_modifier_$0_active}
I can't remember off the top of my head if ChatSetAttr assumes the selected character if none is given.
Attributes start numbering at $0. More info on how to reference them is in the sheet docs, here.
Update v0.8.39 -- Added Min and Max bounds to status marker numbers (Thanks Morgan)
You can append two additional numbers separated by :
. These numbers will be used as the minimum and maximum value when setting or adjusting the number on a status marker. Specified minimum and maximum values will be kept between 0 and 9.
Omitting either of the numbers will cause them to use their default value. Here is an example limiting the max to 5:
Update v0.8.40 -- Added adv_fow_view_distance setting (Thanks Wolf Thunderspirit)
Numbers or Blank
Just like the Numbers fields, except you can set them to blank as well.
Available Numbers or Blank Properties:Here is setting a standard DnD 5e torch, turning off aura1 and setting aura2 to 30. Note that the |
is still required for setting a blank value, such as aura1_radius below.
Just as above, you can use =
, +
, -
, *
, and /
when setting these values.
Here is setting a standard DnD 5e torch, with advanced fog of war revealed for 30.