snuh said: timmaugh said: Just an update that the new version of SelectManager (that has the ability to let players use ids) has just been merged into the 1-click. Here is the post that describes changing the setting to do what Snuh wants to do. Oh, wow! Awesome, thanks! I'm implementing now and it seems to be working great. I got this to run just fine as a player: !cmaster --add,condition=unconscious,duration=600,direction=-1 {&select @{target|token_id}} I am hitting a wall when I try to marry it with APILogic, however. This will cause the API sandbox to crash: !@{target|wtype}&{template:default}{{name=Klak's Sting Save: @{target|character_name}}}{& define ([DCVal] 8) ([DCMFVal] 4) ([SaveRoll] [[@{target|constitution_save_bonus}+?{Roll save|Normal,1d20|Advantage,2d20kh1 (advantage)|Disadvantage,2d20kl1 (disadvantage)}]])}{{DC=DCVal}}{{Con Save (?{Roll save}+@{target|constitution_save_bonus})=SaveRoll}}{& if SaveRoll < DCMFVal}{{Outcome=Massive Failure}}%NEWLINE%!cmaster --add,condition=unconscious,duration=600,direction=-1 {&select @{target|token_id}}{& elseif SaveRoll < DCVal}{{Outcome=Failed}}%NEWLINE%!cmaster --add,condition=poisoned,duration=600,direction=-1 {&select @{target|token_id}}{& else}{{Outcome=Success}}{& end}{&simple} For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined
TypeError: Cannot read property 'get' of undefined
at inputHandler (apiscript.js:5294:49)
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16)
at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8)
at /home/node/d20-api-server/api.js:1750:12
at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560
at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)
at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)
at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)
at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 If I do (basically) the same thing using token-mod it works fine, though: !@{target|wtype}&{template:default}{{name=Klak's Sting Save: @{target|character_name}}}{& define ([DCVal] 8) ([DCMFVal] 4) ([SaveRoll] [[@{target|constitution_save_bonus}+?{Roll save|Normal,1d20|Advantage,2d20kh1 (advantage)|Disadvantage,2d20kl1 (disadvantage)}]])}{{DC=DCVal}}{{Con Save (?{Roll save}+@{target|constitution_save_bonus})=SaveRoll}}{& if SaveRoll < DCMFVal}{{Outcome=Massive Failure}}%NEWLINE%!token-mod --ids @{target|token_id} --set statusmarkers|+sleepy{& elseif SaveRoll < DCVal}{{Outcome=Failed}}%NEWLINE%!token-mod --ids @{target|token_id} --set statusmarkers|+chemical-bolt{& else}{{Outcome=Success}}{& end}{&simple} A friend and I have spent a day trying to troubleshoot but are at a loss. I suspect it's a nesting/order of operations thing but am unable to properly diagnose. Any help would be great! So sorry, Snuh! I lost track of this thread and only now saw you'd had an issue. Not sure if you're still having this issue or are interested in a solution, but I think (breaking down what it looks like you're trying to do) you're trying to pass a selected token along to use with the !cmaster lines. The problem, there, is like you thought... the order of operations. When those {&select} constructions are read you are still in the processing of the original message... so you're adding a selected token to the original message. You need that to be deferred until the CombatMaster message is under examination. The only way I can think to do that is to not rely on the %NEWLINE% bit to trick cmaster into running, but to use the new ZeroFrame batching (beta) capability to actually run this as a multi-line command. That will give you the opportunity to defer the recognition of syntax structures. I think that would look more like this: !{{ @{target|wtype}&{template:default}{{name=Klak's Sting Save: @{target|character_name}}}{& define ([DCVal] 8) ([DCMFVal] 4) ([SaveRoll] [[@{target|constitution_save_bonus}+?{Roll save|Normal,1d20|Advantage,2d20kh1 (advantage)|Disadvantage,2d20kl1 (disadvantage)}]])}{{DC=DCVal}}{{Con Save (?{Roll save}+@{target|constitution_save_bonus})=SaveRoll}} {{Outcome= {& if SaveRoll < DCMFVal}Massive Failure{& elseif SaveRoll < DCVal}Failed{& else}Success{& end}}} (^) !{& if SaveRoll < DCMFVal || SaveRoll < DCVal}cmaster --add,condition= {& if SaveRoll < DCMFVal} unconscious{& else}poisoned{& end},duration=600,direction=-1 {^&select @{target|token_id}}{& end} }}