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

Help modifying a script?

1429156859

Edited 1429156912
Can any Scriptomancers out there tell me how to properly modify this script to include additional status effects I want to keep track of? <a href="https://gist.github.com/aaronworsham/6048845" rel="nofollow">https://gist.github.com/aaronworsham/6048845</a> (Aaron W.'s script) I've tried to add slowed, prone, etc however I am a script-scavenger and not a Scriptomancer. I can't figure out how to structure it correctly.
The script isn't terribly extensible; you'll need to add three things to the script for each condition you want to track: 1) Add an entry in current.markers (lines 11-16). For example (additions in bold): bloodied : (current.token.get("bar1_value") &lt; (Math.ceil(current.token.get("bar1_max") / 2))) , slowed : current.token.get("status_snail") 2) Add a check for that entry in current.flagged (line 21). For example (additions in bold): return (this.markers.marked || this.markers.afflicted || this.markers.ongoing || this.markers.bloodied || this.markers.slowed ) 3) Add a check for that entry where output is generated (lines 33-54). For example (additions in bold): if(current.markers.bloodied){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;bloodied&lt;/strong&gt;!&lt;/li&gt;"; }; if(current.markers.slowed){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;slowed&lt;/strong&gt;!&lt;/li&gt;"; } currentMsg += "&lt;/ul&gt; "
Ah, ok. I missed a step there. Thanks a bunch man!
I tried setting it up and keep getting "unexpected identifier". Doesn't that mean I have an extra character somewhere? Ah well. I tried!
1429274361
The Aaron
Pro
API Scripter
Yes, though it's probably due to leaving out a ' or ", or using the wrong one, etc.
1429283343

Edited 1429283702
I'll take another look at it, thanks.
1429287888
The Aaron
Pro
API Scripter
If you want to post it here, we can help you track it down.
Sorry bud, I had to work a double shift and couldn't get back until now. Here's what I got and I keep getting the same error... Status Reminder (Alteration)
1429419477
The Aaron
Pro
API Scripter
This aught to work: on('ready', function(){ 'use strict'; on ("change:campaign:turnorder", function(obj) { var turn_order = JSON.parse(Campaign().get('turnorder')) || [], current = {}, currentMsg; current.turn=turn_order[0]; current.token = getObj( "graphic", current.turn.id); current.character = getObj('character', current.token.get("_represents")); current.markers = { marked : current.token.get("status_skull"), afflicted : current.token.get("status_bluemarker"), affliction : findObjs({_type:'attribute',_characterid:current.character.get('_id'),name:'affliction'})[0], ongoing : current.token.get("status_greenmarker"), ongoingDmg : findObjs({_type:'attribute',_characterid:current.character.get('_id'),name:'ongoing'})[0], bloodied : (current.token.get("bar3_value") &lt; (Math.ceil(current.token.get("bar3_max") / 2))), slowed : current.token.get("status_snail"), dazed : current.token.get("status_screaming"), immobilized : current.token.get("status_cobweb"), weakened : current.token.get("status_back-pain"), blinded : current.token.get("status_bleeding-eye"), dominated : current.token.get("status_chained-heart"), restrained : current.token.get("status_aura"), prone : current.token.get("status_pinkmarker"), stunned : current.token.get("status_lightning-helix") }; current.name = current.token.get("name"); current.type = (current.character.get("controlledby") === "") ? 'Monster' : 'Player'; current.flagged = function(){ return (this.markers.marked || this.markers.afflicted || this.markers.ongoing || this.markers.bloodied ||this.markers.slowed || this.markers.dazed || this.markers.immobilized || this.markers.weakened || this.markers.blinded || this.markers.dominated || this.markers.restrained ||this.markers.prone || this.markers.stunned); }; // End current turn sendChat('system','/e changes turn.'); //Begin Turn currentMsg = "Is up to bat."; if (current.flagged()){ currentMsg += "&lt;ul&gt;"; if(current.markers.marked){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;Marked&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.afflicted){ if(current.markers.affliction !== undefined){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;afflicted with " + current.markers.affliction.get('current') + "&lt;/li&gt;"; } else { currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;afflicted&lt;/strong&gt;!&lt;/li&gt;"; } } if(current.markers.ongoing){ if(current.markers.ongoingDmg !== undefined){ currentMsg += "&lt;li&gt;" + current.type + " is takeing &lt;strong&gt;ongoing damage by " + current.markers.ongoingDmg.get('current') + "&lt;/strong&gt;! Take Damage?&lt;/li&gt;"; } else { currentMsg += "&lt;li&gt;" + current.type + " is taking &lt;strong&gt;ongoing damage&lt;/strong&gt;! Take Damage?&lt;/li&gt;"; } } if(current.markers.bloodied){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;bloodied&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.slowed){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;slowed&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.dazed){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;dazed&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.immobilized){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;immobilized&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.weakened){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;weakened&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.blinded){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;blinded&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.dominated){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;dominated&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.restrained){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;restrained&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.prone){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;restrained&lt;/strong&gt;!&lt;/li&gt;"; } if(current.markers.stunned){ currentMsg += "&lt;li&gt;" + current.type + " is &lt;strong&gt;stunned&lt;/strong&gt;!&lt;/li&gt;"; } currentMsg += "&lt;/ul&gt;"; } sendChat(current.name, currentMsg); }); }); There was a comma missing, but I cleaned up some other things too... =D
I can't thank you enough man! Works like a charm! Thank you.
1429421743
The Aaron
Pro
API Scripter
No worries! Happy Gaming!