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

Apply a condition through combat master to a target, as apposed to selected

Is there a way to run the combat master api call in a way that affects a target token, as apposed to a the currently selected token?
1728012434
timmaugh
Pro
API Scripter
I don't use Combat Master, but, in general, if a script command would normally affect a selected token, you can swap that over to be a targeted token by installing the Metascript Toolbox and then adding this bit of syntax to the command line: {&select @{target|token_id} } That will basically turn your targeted token into a selected token (provided you have the rights to select the token normally). You *may* need to do a one-time configuration of SelectManager (the part of the Metascript Toolbox you're using with the above syntax) prior to using it this way. Once the Toolbox is installed, go into your game and enter this into chat: !smconfig +playerid +who Explanation (feel free to skip... or let your eyes glaze over) When a script (call it ScriptA) sends a chat message that should access another script (ScriptB), certain properties of the resulting message are lost or changed. For instance, there are no selected tokens, and the playerid and who properties are both "API". SelectManager is designed to be able to track these properties (from the last person to have run a message, the person who sent ScriptA), and give them to the message intended for ScriptB. It gets installed as only giving back the selected tokens, requiring you to turn on the other two properties if you want to use them. For this simple call to Combat Master, I don't *think* you'd strictly need the above configuration to have been run already, but it won't hurt. And since you only have to run it once, you won't have to think about it after that.
Alright, i used the syntax you suggested and it kind of worked, in the sense that, using only combat master through the following base command, it works and allows me to simply select a target, however trying to mix it into scriptcards as seen casues the following error Command 1: !cmaster --add ,id=@{target|token_id},condition=prone,duration=1,direction=-1, this works Command 2: !scriptcard{{--@cmaster| _add ,id={& @{target|token_id}}, condition=prone,duration=1,direction=-1 }} this however spits the error below Any thoughts or mistakes im overlooking? Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again. More info... If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was: TypeError: Cannot read properties of undefined (reading 'get') TypeError: Cannot read properties of undefined (reading 'get') at inputHandler (apiscript.js:9466:49) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:169:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:169:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1766: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 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
1729205245
timmaugh
Pro
API Scripter
Probably this is a matter of the situation I described above, where one script was calling another. In this case, you have ScriptCards calling CombatMaster. The message that goes to CM isn't sent by a player, so it is possible that CM either doesn't know to let you do it, or won't let you target that token because it doesn't know if you have the access to do it.  Do you have the Metascript Toolbox installed, and have you configured SelectManager the way my previous post details?
yes and I'm not sure, how would i check that?
Nevermind, i missed the config command you put. Open mouth, insert foot lol. it works perfectly now, thank you for the help -Wonks