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 to allow possession doesn't give control


Edited 1720527955
I am attempted to write a script to allow a player to possess an NPC. My version is below: !script{{   --#debug|0   --#whisper|self   --&Name|@{selected|character_name}   --&Nameid|@{selected|character_id}   --&TokName|@{selected|token_name}    --&TName|@{target|character_name}   --&TNameid|@{target|character_id}   --&TokName|@{target|token_name}   --&tarid|@{target|token_id}   --&Player|"Albert B"   --#title|[&Name] Possesses [&TokName]   --@token-mod|  _ignore-selected _ids [&tarid]  _set represents|[&Nameid] }} Joshua N. kindly suggested a cleaner script. !script {{   --#title|Possession   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --!graphic:[*T:t-id]|represents:[*S:t-represents]   --+[*T:t-name]|has been possessed by [*S:t-name] }} Both scripts do the same thing when I run them as a player. They change the 'represents' on the NPC's token to the PC's character, but neither one allows the player to select the NPC's token. As the player I can double-click the token and open the token sheet, which is not possible with other tokens. So I have some slight control but still can't select or move the token. According to Roll20 the 'represents' determines control and indeed Joshua reports that when he runs his script on his system as a player, he has full control of the NPC token. I'm running Roll20 on a Mac with Ventura 13.6.7. I'm running the GM on Chrome Version 124.0.6367.62 and the player on Firefox 127.0.2.  TokenMod is set to Players can IDs. I have Timmaugh's complete MetaScriptToolbox in my Mod Library though I am mystified by its magic. Anyone have any suggestions?
So adding a bit more output that may show something going on here. This scriptcard still works for me with a test player account that only had control over 1 token/character and after running this gains control over the target token. !script {{ --#title|Possession --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --+SC Version|[&ScriptCards_Version] --+SentBy|[&SendingPlayerName] GM? [&SendingPlayerIsGM] --+Before|Represents S:[*O:[*S:t-represents]:character:name] T:[*O:[*T:t-represents]:character:name] --+Before|Controlled S:[*O:[*S:t-represents]:character:controlledby] T:[*O:[*T:t-represents]:character:controlledby] --!graphic:[*T:t-id]|represents:[*S:t-represents] --+After|Represents S:[*O:[*S:t-represents]:character:name] T:[*O:[*T:t-represents]:character:name] --+After|Controlled S:[*O:[*S:t-represents]:character:controlledby] T:[*O:[*T:t-represents]:character:controlledby] }} It works with both the 1Click version of ScriptCards and the latest Github version of ScriptCards. I also tested this with the test player account logged in via Firefox and also via Chrome Incognito. All works for me. You can see the target token had a different character and that character had no controlledby players and after the target token changes to the source character and has the same player list as the source token.

Edited 1720567082
I tried this new script and the output is below. As you can see I’m using SC Version 2.7.10 and control of the Alice token after possession is identical to that of Albert as it should be. So we now know the system believes Albert has control of the Alice token. Unfortunately Albert still can’t select the Alice token and has just the double-click to open token settings. Thank you Joshua for your continued interest and efforts and particularly for your expertise and skill at ScriptCards. This is weirder and weirder. SC Version 2.7.10 SentBy Albert B. GM? 0 Before Represents S:Albert T:Alice Before Controlled S:-O-RDkq61GJ6FOchWRxr T: After Represents S:Albert T:Albert After Controlled S:-O-RDkq61GJ6FOchWRxr T:-O-RDkq61GJ6FOchWRxr For some reason I couldn't get the comment program to take the screen shot of the output so I had to copy and paste the results. Is this a hint?? (I thought I'd better add that I am being facetious about being a hint. The problem is undoubtedly my screen shot program not my computer system.)
Hmmm. Just to rule out a couple things, here's a new version with different output: !script {{ --#title|Possession --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --+Before|Token Controlledby S:[*S:t-controlledby] T:[*T:t-controlledby] --!graphic:[*T:t-id]|represents:[*S:t-represents] --+After|Token Controlledby S:[*S:t-controlledby] T:[*T:t-controlledby] --+Locked?|[*T:t-lockMovement:::false] }} And to confirm you get the same result regardless of the target token? No token, even a freshly dragged out token, works as a possession target? I am rapidly running out of even barely credible ideas as to what it can be. Maybe a brand new test game with some transmog'd characters just to confirm it's not Roll20 game weirdness.
 Bingo! I was just trying this new suggestion and was going to try making a new game when it occurred to me that I had never mentioned that I had made this game using Jumpgate. I had just foolishly assumed you were using Jumpgate. I tried this on a pre-Jumpgate game and I could now select the possessed token. I will report this as a bug in Jumpgate and hope that they can solve it because I have made enormous changes to the game, in particular using Hash in place of using an ability called Chart to record character's attributes and of course there is no going back from Jumpgate. If I have to go back all that work must be redone. (I used the ability Chart since I found creation of character sheets too complicated, so I created my Roll20 game of Vampire Dark Ages without them.) Thank you again for your interest, support, expertise and help. It was your suggestion of a new game which turned on the light and I will use your program "!graphic" for possession rather than token-mod, much more elegant!  
Oh Jumpgate. I should've asked. Good catch. What a weird bug that is. Glad you figured it out and hopefully the devs can get that debugged and fixed soon.
Forum Champion
Hi James B.,  As a reminder please forward all Jumpgate bugs to the Devs so that they can take a look at it. Including API Script issues as they should function in Jumpgate without changing the script (compared to Regular Roll20).  You can contact the Devs via the Jumpgate forum thread or via the Help Center . 
I reported it as a Jumpgate bug through the link "report a bug" on the start of chatlog on my Jumpgate game. Is that sufficient or should I also enter information in the Jumpgate forum?
Forum Champion
James B. said: I reported it as a Jumpgate bug through the link "report a bug" on the start of chatlog on my Jumpgate game. Is that sufficient or should I also enter information in the Jumpgate forum? Up to you. You have informed the Devs, but by posting it in the Jumpgate forum you also inform other users. :)