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

[Script] Conditions and Status Tracker

Sorry if im' being slow but do not understand what I need to do to remove a single status as described in the last post. Could someone help? I can remove all statuses using the !StatusClearAll command but cannot remove a single status which is really necessary if you have multiple markers. Thanks in advance for any assistance.
Isembard said: Sorry if im' being slow but do not understand what I need to do to remove a single status as described in the last post. Could someone help? I can remove all statuses using the !StatusClearAll command but cannot remove a single status which is really necessary if you have multiple markers. Thanks in advance for any assistance. So basicly add the statuses Manually instead of via a macro. Then you type !StatusDel (The name of the status you gave) For example I have a macro which automatically does !StatusAdd Bless, 1, atk+1, // all-for-one which adds the bless status. However it cannot be removed in this fashion via !StatusDel. Don't ask me why. If however you type this out in the chatbox. It should be removable via the !StatusDel command. Something to do with Macros make them undeletable. The work around was simply have the Macro bring up prompt boxes which I had to press submit too. So for Example !StatusAdd ?{Status Name| Bless}, ?{Status Duration|1}, ?{Status Notes| Atk+1} etc etc So what this does is basicly bring the prompt up with the information already written in it, meaning all I have to do is press Submit a few times and it assigns the Status marker while being also removable via StatusDel. DO NOT ask me why this work around works. I don't know this language. Iv worked alot more with Maptools and Javascripting then I have HTML5 I think this is.
Hey all, I am revisiting this and I wanted to address some of the oddities that seem to be appearing. I do want to note that the comments at the beginning of the script are from an older version and need to be updated, which I will do once I finish cleaning this up. I am not having the issues mentioned above with macros adding and deleting from tokens. I created a marked macro: !StatusAdd Marked 1 -2 to attacks if not targeting @{selected|token_name} And this worked fine for me. I am not sure what is the issue for others, but I certainly am willing to help if we can troubleshoot it somehow. I am working to simplify this to increase usability
Correction, the @{selected|token_name} cannot be used. When you use the targeting system, it deselects your original token, thus breaking this script. Instead I am using: !StatusAdd Marked 1 -2 to attacks if not targeting ?{Enter the name of the marker} // white-tower I have run it several times now and it works fine. I realize there are some problems with the token id system I have in place, so I am fixing it now.
1389805966

Edited 1389806169
Ok, I have updated this script and it works much better. I have also added some usability features to the script. First, when you add a status effect to a token, it will confirm it in chat (See formatting to the right, you can change the foreground and background colors in the seetings). Second, when you come to a tokens turn in initiative, it highlights the beginning and end of all the effects on the token. In an effort to troubleshoot, I had to remove one functionality. Effects are now ONLY assigned to TOKENS! This means that if you change pages, or copy and paste tokens, you will have to then assign the status effects to the new token. I did this for one main reason: In my campaign, we have 'characters' for every monster type in the campaign, with stats for the base monster and an assigned token. That token has a hit point value in bar1, but it is not linked to HP. This means if I want 5 goblins in an encounter, I can drag and drop 5 goblins from the journal to the game board to build an encounter quickly. IT works great! BUT, in the old way this would work, it would assign a status effect to EVERY goblin if one was affected. Obviously, this will not work and thus the change. A small price to pay. It should be noted that old statuses will remain (So if you leave a page, and type !StatusAll, it will still list statuses on tokens on other pages). This is a helpful reminder for a GM whom needs to remember things like diseases which can stay for a long time in 3.5e dnd. Please look over the new script, I would greatly appreciate feedback.
Thank you so much for this. This script will have a massive benefit to my game. I have no programming skills so you contribution is invaluable to me.
Just had a quick try works great the coloured backgrounds are a good addition as they make the chat window a lot clearer.
I love you Josh. You are my star, my muse, the support of my whole world. :P
Tack said: 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? @Tack: I know this is old, but it is an interesting proposal. I have to admit I am curious if I could do something like this (I love a good challenge), but to code it, you would have to have specific conditions met to specific status effects. Its actually relatively easy to remove all status effects if a token is 'killed'. Just add to the bottom of the code for bloodied or dead (the final function in the script) that it sets the marker string for the token to "", it would then wipe out all status markers before applying the dead one. The problem with adding that type of functionality is that it is still subjective. In some game systems, if you are diseased or poisoned, when you are resurrected, you are not always cured of those statuses. Trying to lock down which ones are or are not removed is very cumbersome, and leaves a lot of room for errors. To your other question, about removing effects when moving in and out of light: I do not believe so. I dont think the API has access to the dynamic lighting layer, nor testing if a specific location has light. That type of coding would need to be added before we could do something like that. Its an interesting thought tho. If it were possible tho, it would be an interesting concept. Imagine if all characters outside a light zone where autmatically given the 'blind' status effect, and it was removed when they moved out. Handy.
Anders said: 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. Anders, this problem you mentioned should now be solved.
@Saevar: My pleasure ;) FYI I looked back at your old posts. One thing to be aware of, my coding does not like commas. So if you use your macro: !StatusAdd Bless, 1, atk+1, // all-for-one Then the !StatusDel will not work, unless you type: !StatusDel Bless, The code delineates based on spaces, not commas. Hope this helps
Greatly appreciate the updates sir! color settings are also good for those of us who have colorblind players, so for that I thank you again.
AHHHHHH Josh you are right. Some reason I took a sentence from somewhere of yours with commas and assumed they had to be there. DOH Ah well Forgive me for my blind-sight :P
Your work is great for coding dummies like me. Thank you for putting the time in!
Josh, I like the idea of this script and was thinking of implementing it in my campaign, I just had one question about it. When you want to add a status and use a specific marker to signify it, can you type in the name of the marker (I believe they are all listed on the wiki) to add a specific marker like say "wrench" or "snail"?
Yes you can. !StatusAdd ?{Status name} ?{Status Duration, -1 for perm} ?{Status description} ?{Type GM for GM only} // ?{Status Indicator [default is purple]} This macro will get it to prompt you which marker you wish to use, which will be the last question.
Oh, that's perfect. Thank you. With what Quatar had mentioned about allowing players to use this script, I feel like it would be valuable in the aspect of setting up token actions and including this in with the macro.. say a fighter attacking and including this to mark the target would be immensely helpful for any GM as it would lighten the workload, Especially with the inclusion of the workaround of adding "|info" after the prompt so that it will already have it included.
So i can't seem to change the personal settings for Status of dead to status of broken-skull. Not in personal settings or changing Status_dead to Status_broken-skull. Is there something else I would have to change?
Ooops, I forgot to change that part when they changed the status markers. I will do an update.
1391557935

Edited 1391558173
Matt
Pro
I've come up with a solution for the following issue: Effects are now ONLY assigned to TOKENS! This means that if you change pages, or copy and paste tokens, you will have to then assign the status effects to the new token. I've added the following bits of code to allow the effects from one token to be moved to another. So when changing maps, I can select the token and use the command !StatusCopy. I can then move to another map, select the target i want to move the effects to, and use the command !StatusPaste. It also moves any status icons and tint, even if not associated with this script. I had to add an additional field in the declarations. StatusTracker.CopyFrom = ""; //source CharID Here are the additional commands for !StatusCopy and !StatusPaste. on("chat:message", function(msg){ var cmd = "!StatusCopy" if (msg.type == "api" && msg.content.indexOf(cmd) !== -1 && msg.who.indexOf("(GM)" !== -1)) { try {if (msg.selected.length !== 1 && msg.selected._type != "graphic") { sendChat("","/desc Copy Err: multiple targets"); } else { StatusTracker.CopyFrom = msg.selected[0]._id; sendChat("","/desc Copy from " + StatusTracker.getTokenName(StatusTracker.CopyFrom)); } } catch(err) { sendChat("","/desc Copy Err: no target"); } } }); on("chat:message", function(msg){ var cmd = "!StatusPaste" if (msg.type == "api" && msg.content.indexOf(cmd) !== -1 && msg.who.indexOf("(GM)" !== -1)) { if (StatusTracker.CopyFrom == "") { sendChat("","/desc Paste Err: missing source"); return; } try {if (msg.selected.length !== 1 && msg.selected._type != "graphic") { sendChat("","/desc Paste Err: multiple targets"); } else { if (StatusTracker.CopyFrom == msg.selected[0]._id) { sendChat("","/desc Paste Err: target is source"); return; } _.each(state.activeStatus, function(obj){ if(obj.CharID == StatusTracker.CopyFrom) obj.CharID = msg.selected[0]._id; }); //move the status icons as well var moveFrom = getObj("graphic", StatusTracker.CopyFrom); var moveTo = getObj("graphic", msg.selected[0]._id); moveTo.set("statusmarkers", moveFrom.get("statusmarkers")); moveTo.set("tint_color", moveFrom.get("tint_color")); moveFrom.set("statusmarkers",""); moveFrom.set("tint_color",""); StatusTracker.CopyFrom = ""; sendChat("","/desc Applied to " + StatusTracker.getTokenName(msg.selected[0]._id)); } } catch(err) { sendChat("","/desc Paste Err: no target"); } } }); Hope this helps. Thanks again Josh for a great tool!
So the markers have stopped working for me! It adds the token to the list of effects currently in play but won't assign the markers anymore! It was working previously and then it suddenly stopped working! I copied the campaign and used it in a new one and it still does not work. I feel that ethier my campaigns are bugged or there has been a change to the way APIs work recently. To make it clearer. I tried every combination of getting it to add the icon via the script. I had macros which previously worked but have stopped working. I used it in a new campaign and still nothing.