[Script] Conditions and Status Tracker

1371150319

Edited 1389805632
Josh
Pro
So I have created a status tracker based on a request. I have used the state object so status maintains between sessions. The purpose of this script is to keep track of a token/players status, and count down the number of rounds until it is lost. It also allows for the storage of permanent effects which need to be ended manually. It will give indicators as you see fit (described below) and it will give a status marker of your choice on the token. Here are the commands: Commands: First select the tokens you wish to be affected. !StatusAdd <status name> <duration, -1 for perm> <description> <GM Only> <status indicator: blank means uses your default> !StatusDel <status name> (affects all tokens selected) !StatusAll !StatusClearAll Adding a status will flag the character/token named with the status name. So an example: !StatusAdd Bless 10 +1 to attacks This will add a Bless effect to the selected tokens for 10 rounds. It will also note that each gets +1 to attacks each round when their turns comes up. At the end of the duration, the status will be deleted. The GM only flag will only show the status to the GM and not the players. To use the flag, just end the line with GM. An example: !StatusAdd Diseased -1 -1d6 CON per day GM This will flag the selected tokens as Diseased, remind the GM that Josh gets -1d6 CON per day, but only shows it to the GM. There are some personal settings as well: StatusTracker.statusIndicator = "purple"; //none means no indicators, you choose the color of the marker to indicate a status exists StatusTracker.GMName = "DM (GM)"; // The GM's name so he/she can give instructions StatusTracker.Chat = true; //Uses chat window to give indicators StatusTracker.ChatDescriptions = true; //displays descriptions (set to false if you do not want to see them) StatusTracker.ChatOnlyGM = false; //All chat only goes to the gm, players do not receive notifications Here is a link to the code: https://gist.github.com/DarokinB/5776368
This is awesome. I just have one request, and I know nothing about coding at all so if this isn't possible I'm sorry. Is it possible to make it so that the names are not case sensitive? Edit:  Also, when I made one of the effects permanent, it stopped notifying about it. Can you change this? Or make a toggle? I can get around that by just setting the number really high such as 99 for save end effects but I'd rather not do that.
1371267778
Josh
Pro
Hmmm... it should be notifying you with permanent effects. I will look into it.
Honestly, it might be my fault. It took me forever to figure out I needed to set names to shown for the damn thing to work.
1371865804
Having difficulty getting this to work - I loaded the script, and tried adding a status via the referenced commands... nothing worked.  Even !StatusAll is failing to do anything (no errors in the API console, no indication it's running, etc.)  Is there anything I would need to do or check for, beyond copying & pasting?  :)
its another one that needs to be fixed: search for _turn and replace it with turn (ctrl-F works) at least It worked for me that way. 
Excelsias said: Having difficulty getting this to work - I loaded the script, and tried adding a status via the referenced commands... nothing worked.  Even !StatusAll is failing to do anything (no errors in the API console, no indication it's running, etc.)  Is there anything I would need to do or check for, beyond copying & pasting?  :) You need to set it so all of your tokens that you're trying to put status effects on have their name viewable by all players. Don't need to have nameplate, just have the name viewable for all players.  Edit: Everything has to be case sensitive. If the players name is "Bob" and you do "!StatusAdd b ob bless 10 + 1 to attack rolls" that won't work. However, "StatusAdd B ob bless 10 + 1 to attack rolls" will work.
1371957460
No luck; I replaced _turn with turn, checked case-sensitivity, and also made sure that nameplates and name are viewable to all.  Still nothing.  Any other ideas?
Did you set the DM name in the script settings? You have to leave the (GM) part.
1371998077
Josh
Pro
Also, when you need to send the command, you need to be speaking as the GM.
1372008675
Weird - Yes, I have checked both.  I changed my display name at one point, but just changed it back to double-check, and stlil no luck.
1372010127
Josh
Pro
Whats the display name you are using?
1372033471
Ben - then switched back to Excelsias.  Didn't work with the script set to Ben (GM), or Excelsias (GM)
1372088285
Josh
Pro
Ok, I noticed one odd thing... My teleporting script over wrote my status script. Odd. I fixed that. Also, I changed the gm test. Instead of having you enter the name, it just looks for (GM) to be present. If one of your players adds (GM) to be a pain, kick em out!
1372091014
That works!  I am uber-excited, thank you.  Quick Q btw - how hard would it be for conditions, when created on a token, to add append a line in the token's GM notes at the end, like: <p><b>Description_Name</b>:  <description_text></p> And then, after the effect expires... never mind.  Would be hard to automatically delete that line.  It would be, however, very cool if it existed :) Since it doesn't - is there an alternative to !StatusAll to list the conditons for a specific character/token only (like !StatusToken Bob?)
Is it possible to see a screenie of this script in action?  This is something that I'd upgrade my sub for, but I'd prefer to see it first if possible. Thanks!
DM Giantsauce said: Is it possible to see a screenie of this script in action?  This is something that I'd upgrade my sub for, but I'd prefer to see it first if possible. Thanks! Here you go. Sorry for the lack of a video, but this is a small showcase of the script in action. Here I am about to add the "Poisoned" condition to Robert. He gets marked with a purple marker. A couple turns go by and you can see on the chat what happened. And now I added a couple more conditions to other players and used the !StatusAll command. Check the chat. I have the script set so that only the GM gets updated on status change, but you only need to change a variable so that others can also see it. Thanks to Josh for the amazing script.
1373379065
Josh
Pro
Adding a note to the GM field is an interesting Idea I had not thought of. I will play around with it and see what I can do.
1373472481
Axel Castilla
KS Backer
This is a very cool functionality, Josh.  Thank you for sharing scripts like this one.
I tested this script last week and ran into an unfortunate bug. Whenever the Turn Order is changed, not just to the next person but a character changes his initiative, I move around someone, I add a new token or I delete one that was killed, it reduces the remaining duration on the current token by 1 round. This makes it a bit unreliable at best. It should remember who the current token is, and if the "new" token is the same one, it shouldn't do anything. Also is it possible to have more than one dot showing. I could for example type !StatusAdd green John Blinded 7 Can't see anything or so, and it would add the green dot for this effect. That way I can keep certain effects a certain color thoughout the tokens, and can see at first glance who's blinded, shaken or paralyzed for example. A "none" should also be an option there, in case some effect shouldn't show (maybe secret GM effects). Furthermore is there an option that players can use !StatusAdd on their own tokens (but not on others that they don't control)? It would help immensly with taking some workload of the GM. Also (minor bug), when I end an effect with !StatusDel it does not immediately remove the marker. It does so once the turn order updates, so not a biggy, but I figured I mention it. Also, one of my players character is named "Wu Nakito". If I type !StatusAdd Wu, nothing happens, with !StatusAdd Nakito it works. Not sure if there's a minimum length of characters or something, but again I figured I mention it
1374596264
Josh
Pro
I have updated this for the new features added. Now the system will look at all the tokens you have selected, and apply the status to all of them. For instance, if you select three tokens and type: !StatusAdd Bless 10 +1d4 to all attacks Bless will be applied to all of them for 10 rounds. Similarly, if you select all of them, type "!StatusDel Bless" it will remove it from all those selected. This will significantly speed up the process. Secondly, I fixed a lot of the glitches mentioned above by Quatar. Now changing initiative order will not cycle the durations. The only problem exists is in the event a token delays their turn. i.e They get to their turn, and decide to wait. When you move them to later in initiative, it will cycle them again. I am trying to figure out a solution to this without having to use text commands. Lastly, with the new queries, I would recommend a new macro for status adding: !StatusAdd ?{Status Name} ?{Status Duration} ?{Status Notes} ?{Type GM for GM only notifications} Now, select the tokens you wish to add a status, enter the prompts, and move on. I tested it and it is incredibly quick!
1374596783
Josh
Pro
Quatar said: Also is it possible to have more than one dot showing. I could for example type !StatusAdd green John Blinded 7 Can't see anything ...A "none" should also be an option there, in case some effect shouldn't show (maybe secret GM effects). Furthermore is there an option that players can use !StatusAdd on their own tokens (but not on others that they don't control)? It would help immensly with taking some workload of the GM. These I am still working on. The multiple status indicators will be less of a priority for me, because it conflicts with other scripts I use (I use a different indicator for different scripts), but I will add it. I didn't add the player option because I was concerned with players ending the effects sooner than intended.
Josh said: I have updated this for the new features added. Now the system will look at all the tokens you have selected, and apply the status to all of them. For instance, if you select three tokens and type: !StatusAdd Bless 10 +1d4 to all attacks Bless will be applied to all of them for 10 rounds. Similarly, if you select all of them, type "!StatusDel Bless" it will remove it from all those selected. This will significantly speed up the process. Secondly, I fixed a lot of the glitches mentioned above by Quatar. Now changing initiative order will not cycle the durations. The only problem exists is in the event a token delays their turn. i.e They get to their turn, and decide to wait. When you move them to later in initiative, it will cycle them again. I am trying to figure out a solution to this without having to use text commands. Lastly, with the new queries, I would recommend a new macro for status adding: !StatusAdd ?{Status Name} ?{Status Duration} ?{Status Notes} ?{Type GM for GM only notifications} Now, select the tokens you wish to add a status, enter the prompts, and move on. I tested it and it is incredibly quick! <3
This script works great! Is there any way to give this command options to a player instead of just GM. It would be great in D&D as a Warlord you give lots of bonuses to other players, it would be neat to take advantage of this feature there! Thanks!
1374693973
Josh
Pro
Yes, delete this from the script, anywhere it appears: && msg.who.indexOf("(GM)") !== -1 I may also add a flag at the beginning to make it so you can change the setting. I am waiting on updating this, however, until the new API changes are posted and I can update it. Quatar, I also am adding your suggestion: With each command you will be able to choose a flag for the status, taking advantage of the new marker system. I have a feeling I know how its going to look, so I have done a lot of pre coding already to prep for it.
This still Isn't working for me. I've got the "end of turn" initiative tracker running also, I don't know much about these but I don't see how they would interfere with each other. Is there something I missed? I've searched (ctrl-f) for the GM thing and the _turn parts but I think you must have fixed them already because i found nothing. Other than that, I'm selecting a token and trying the example bless command you wrote with the tokens name (all players can see the name). I've tried without putting a name in like you later said you updated. Maybe its because no players are online right now? Its just me. But the tokens are set to be controlled by certain players regardless...
1375412146
Josh
Pro
The name typing was eliminated with the most recent update. Now it just applies to the tokens you have selected
As I said, in a very confusing way, I've tried that already. =P
1375417051
Josh
Pro
What is the error you are getting from the API? EDIT: Noow I see. You do not enter the name when you have the token selected. Just the effect, duration, notes, gm flag etc. Also note that until they bridge for the flags, you will not see any status indicator on the token. Type !StatusAll to confirm it is in place
1375816848
Josh
Pro
I have updated this for the new API settings on markers. It also includes a bloodied / dead tracker. If your character is at less than half hp, it will tint the token red, and if dead (0 value on bar1) then it will mark it as dead. Please remember to click the link, as the embedded code is not the most up to date. Enjoy!
Is it possible to change that tint to the red status dot?
1375829142
Josh
Pro
It's a lot of work, and it would prevent the user from being able to use the red dot for anything else. 
1375829534

Edited 1375829815
Okay, thanks for letting me know. Does that bloodied value thing only work if the health attribute is called "hp"? Are roll queries only on the developer server? edit: No, they're on live, but instead of parenthesis, you're supposed to use brackets. { }
1375886093
Josh
Pro
For bloodied, there does not have to be any assignment to bar 1. It just must have a current and max value and the current must be half the max or less, and it flags them as bloody. Here is the updated status macro: !StatusAdd ?{Status Name} ?{Status Duration} ?{Status Notes} ?{Type GM for GM only notifications} ?{Please choose a marker, blank is default}
1375897342

Edited 1375898057
Josh
Pro
Ok, I did another update. I had to change the way in which it deals with status indicators. As it was, it would override ALL status markers you had in place for only what was used in this system. This was unacceptable, because there are times we need to use markers outside of this script. So now, it adds a marker of that type to the token, and then removes it when you either remove the effect or its duration ends. If you add other markers it will leave them alone. Some suggestions for playing with this. GMs would likely want to have macros for 'afflictions' that happen often. For instance, my players mark often in the game, so I created a Marked macro. It reads like this: !StatusAdd Marked 1 -2 to attacks unless attacks marker  // blue To use this, I select the token that is being marked, click on the Marked macro (which I made and added to my macro bar), and he is flagged as marked. Easy!
1378955103

Edited 1378956226
ok, having problems getting the !StatusDel to work the way I want. I want to be able to click an token and have it remove the status from the icon as well as from the scripts status list. currently I cannot even get it to work with [ !StatusDel <tokens name> <Status name> ]  .   I am currently DM'ing gurps, and it would be good to be able to set a status using this script without tracking it in the turn order, but I cannot get the darned silly thing to work Ideally, would like to be able to do a [ !StatusAdd slowed -1 1/2 move // snail ] and be able to overwrite the status with [ !StatusAdd slowed -1 1/10th move // snail ], rather than have it simply add another status marker with the same name, Also, the ability to put statusmarker numbers in the script would be fairly awesome so that I could, for example, put [ !StatusAdd hp -1 less than -2xHT // heart 2 ] so that it puts the number 2 on the heart ( in gurps you can go up to -5 times your health, and sometimes need to track if you are over -10 times your health!) EDIT: The second status add request is aleady fuctional, just make sure you type it correctly (snail@2 puts the snail icon up with a 2 on it). Just make sure you use the @ symbol - I was using the hash, whoops
1378994886
Josh
Pro
The StatusDel has stopped working with the markers for some reason. It still removes them from when you do !StatusAll, but the markers remain. I am guessing they may have changed the way in which token markers work again, I will put some time into it asap to figure it out.
[CENTER][URL=http://www.nodiatis.com/personality.htm]http://www.nodiatis.com/pub/20.jpg[/IMG][/URL][/CENTER]
1381255092
If I have multiple tokens from the same character journal, the duration drops on each of those tokens' turns, and they all gain the status, if I give it to (only) one.
Sorry, i'd do it myself but I'm not exactly javafriendly. But is there a way to put conditional status removals in? I.E. if X token is killed, status goes away, or if Y token leaves the lit area, status goes away?
1385851577
Josh
Pro
Hey all. Once the new rugged roll out makes it onto the main server (I stopped working on the dev because I want scripts for the stable environ on the main server) I plan on reworking this script. Anders, I have the same problem as you because I use one journal entry for all my monsters (I have a zombie entry, etc). I will be working a solution around this problem when I rebuild this. Its a complicated solution however.
Can't wait but this is really good code as it stands. I appreciate the functionality, and the well commented code. I will be adding this to my active campaigns, and will look forward to the update!
1386055197
Josh said: Hey all. Once the new rugged roll out makes it onto the main server (I stopped working on the dev because I want scripts for the stable environ on the main server) I plan on reworking this script. Anders, I have the same problem as you because I use one journal entry for all my monsters (I have a zombie entry, etc). I will be working a solution around this problem when I rebuild this. Its a complicated solution however. Sounds great. Think next year will be great for some more roll20.
1387333596
Fabio M.
KS Backer
Anders said: Josh said: Hey all. Once the new rugged roll out makes it onto the main server (I stopped working on the dev because I want scripts for the stable environ on the main server) I plan on reworking this script. Anders, I have the same problem as you because I use one journal entry for all my monsters (I have a zombie entry, etc). I will be working a solution around this problem when I rebuild this. Its a complicated solution however. Sounds great. Think next year will be great for some more roll20. Hi, I'm slightly hijacking the thread here, but for a good reason ;) I have my own system of status tracking and effects, and I wanted to solve the problem of multiple tokens sharing the same character's journal by way of duplicating the journal. Basically in my script, before applying an effect that would affect more than one token (by way of a shared journal), I copy the "archetype" journal into a new one named after the token, then assign the token to it. Only then I apply the effect. Unfortunately I bumped in a problem: after copying the journal and assigning it to the token, if I try to write an updated attribute into it, it throws out an error. You can see my post about it here: post . So Josh, if you think this could be a solution for your code as well, it would be nice if you had time to try it out and see whether you have the same problem.
1389379682

Edited 1389380075
I have found a strange occurance. If I use a macro to automatically add the status to a token. EG !StatusAdd prone, -1 -5 penalty on attack rolls when striking at a non-prone enemy. Conversely, nonprone creatures enjoy a +2 bonus on attack rolls to hit prone foes, // back-pain It will add it as normal... However if I use !StatusDel prone it will not remove it! But if I add StatusAdd prone etc manually the !StatusDel will remove it! The clear all commands still works but it removes any other status too unfortunally :( Edit A Work around is to use the ?{X|X} Command and just press the submit button a few times.
1389382449
aRotondi
Sheet Author
Saevar L. said: A Work around is to use the ?{X|X} Command and just press the submit button a few times. Could you elaborate on this please? e.g. does the entire manual command (!StatusDel ... etc.) go here or just part of it?
Sorry. so I would use a macro for the command to automatically add a Status such as. !Prone, -1, Text, back-pain Then if I wanted to remove it using !StatusDel prone nothing would happen. Wouldnt get removed in any combination of words etc. If I however typed it out it would removable via !StatusDel prone command. Nothing different in the string to create the status A work around I found was to use the ?{Status name| Variable name here} etc commands and just pressing submit a whole bunch of times.