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 Cards Whisper

1735857406

Edited 1735857513
I apologize if this is in the forum or script card documentation somewhere.  I've tried searching and gotten nowhere, so I'll ask here. Can you make script cards whisper output to a player based on having a token selected?  I am trying to create a script card with a few random messages offering the players "help from the dark powers" in exchange for a corruption check.  The messages are random to add flavor (I have a dozen or so).   I can hard code the target to whisper the card to with the following line and the message will be whispered to the GM and the player galen d.:     --#whisper|gm,galen d., What I can't seem to figure out (and forgive me, I don't code that often, maybe this is stupid simple) is how to make it use something like      @{selected|token_name} Suggestions?  Or am I trying to do something that Script Cards don't support?
Scriptcards has its own Discord that is hugely useful, but you could either have the player run the script and use 'self' in place of the player's name or insert a line before the whisper and use the --#sourcetoken|@{selected|token_id} line to grab the desired target and then have whisper line read , --#whisper|gm, [*S:t-id] . I am away from pc right now, but both of those should work AFAIK
Thank you.  I will try a rewrite to see if that works.  As I needed the script card for today I wound up writing 7 versions of the script, one for each player, and then creating a macro with button calls to each version of the script by player name.  I also have the script card offering different game boons, and as I had to create the buttons anyway I skipped making the script card branch as a single piece of code and just made 21 versions of the same script with slight edits (7 players x 3 types of boons = 21).  That is awful brute force and ugly.  If I can get the selected token thing to work I might just thin this down and create a script card with appropriate branching.  I'm not a programmer by trade, but did take some programming in college, and this approach just makes me cringe even if it does work. I will check out the discord if I can find it.  I am guessing there is a link buried in the forum that I didn't see.   Thanks for the direction.  I really appreciate it.
1736003956

Edited 1736004303
Just been testing and this definitely works for me with a proper dummy account set up as a player - NB I misfired due to early morning and slow brain boot speed, it should be [*S:name] not [*S:t-id] !script{{ --#sourceToken|@{selected|token_id} --#title|Something Cool --#whisper|[*S:name],gm --+| [b] Devious DMings afoot![/b] }}
Discord link from the also-very-helpful Scriptcards Wiki <a href="https://discord.com/invite/jSB4wTNpXb" rel="nofollow">https://discord.com/invite/jSB4wTNpXb</a>