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

[Question] Carried Tokens, changing the script a little...

1383477385

Edited 1383477408
Would it be possible to change the script from this thread <a href="https://app.roll20.net/forum/post/201089/script-ca" rel="nofollow">https://app.roll20.net/forum/post/201089/script-ca</a>... so that the token does not have to belong to a player in order for them to use the !carry command? The issue is that this script doesn't work if the token is linked to a character sheet (and permission settings configured properly there), it only works with generic tokens and permission settings within said tokens - otherwise it spits out the 'this token does not belong to you' error. Of course, the GM can always use the command but I want my players to give lightsources or important items to other characters on their own accord (and no more squabbling who still carries an item or not or who was first) without my help. So, do I just remove this part or does this break the script? // You must be in control of your token and the carried token. if((myToken.get("controlledby").indexOf(getPlayer(msg.who).get("_id")) !== -1) || msg.who.indexOf("(GM)") !== -1) { for(var i in arrCopy) { var carriedToken = arrCopy[i]; log(carriedToken); _dropCmd(myToken, carriedToken); sendChat(msg.who, "/em : " + myTokenName + " dropped " + carriedToken.get("name")); } } else { sendChat(msg.who, "/w " + msg.who + " " + myTokenName + " does not belong to you!"); } }
1383556572

Edited 1383556728
maybe // You must be in control of your token and the carried token. if((myToken.get("controlledby").indexOf(getPlayer(msg.who).get("_id")) !== -1) || myToken.get("_represents").indexOf(getPlayer(msg.who).get("_id")) !== -1 || msg.who.indexOf("(GM)") !== -1)) { for(var i in arrCopy) { var carriedToken = arrCopy[i]; log(carriedToken); _dropCmd(myToken, carriedToken); sendChat(msg.who, "/em : " + myTokenName + " dropped " + carriedToken.get("name")); } } else { sendChat(msg.who, "/w " + msg.who + " " + myTokenName + " does not belong to you!"); } } to my shame i do not yet have subscription so cannot test it that works. P.S. "||" symbol for some reason is not getting bold.
Thanks but doesn't work, unfortunately. Also tried (blindly, of course, I have no clue about programming) to replace all the 'myToken' parts into just 'Token' but still get the same error message so that doesn't even seem to matter. If only this script would pull from the charactersheet or the token settings instead of being restricted to just the token settings.
1383575537

Edited 1383575713
well (myToken.get("controlledby").indexOf(getPlayer(msg.who).get("_id")) !== -1) checks if token can be controlled by player maybe // You must be in control of your token and the carried token. if((myToken.get("controlledby").indexOf(getPlayer(msg.who).get("_id")) !== -1) ||(myToken.get("_represents").get("controlledby").indexOf(getPlayer(msg.who).get("_id")) !== -1) || msg.who.indexOf("(GM)") !== -1) { for(var i in arrCopy) { var carriedToken = arrCopy[i]; log(carriedToken); _dropCmd(myToken, carriedToken); sendChat(msg.who, "/em : " + myTokenName + " dropped " + carriedToken.get("name")); } } else { sendChat(msg.who, "/w " + msg.who + " " + myTokenName + " does not belong to you!"); } } will do (i see now why first one didn't)