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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Bug] So...whats wrong with this chat script?

I made this chat script to test altering the whisper system (no I wasn't going to use it as is, at the very least not without total player permission) - and it crashed my game. In fact, I couldn't view the chat archive nor load the game until I'd both disabled the script and deleted my entire chat archive. So...um, what's wrong with it? on("chat:message", function(msg) {   if(msg.type == "whisper") {     sendChat("Jay", "/w Jay" + " sent by" + msg.who + "Sent to" + msg.target + msg.content);   } });
I would suggest instead of using message type, try using index of /w?
Sorry - could you provide an example? If I'm understanding you correctly, I don't see how it's msg.type causing my issues.
Hang on...oh I can't believe I was this stupid... Every time a whisper occurs, I'm sending a whisper is response. no wonder I got a looping stream of messages...Sigh
1377471253

Edited 1377471330
Lithl
Pro
Sheet Author
API Scripter
on('chat:message', function(msg) { if(msg.type == 'whisper' && msg.who != 'SYSTEM') { var message = msg.content.substring(msg.content.indexOf(' ', msg.content.indexOf(' ')+1)); sendChat('SYSTEM', '/w Jay '+msg.who+' whispered to '+getObj('player',msg.target).get('displayname')+': '+message); } }); Something like that should avoid an infinite loop locking up your campaign.
Same concept. The point is to keep either two different types of vars, or distinguish between them.
1377507163

Edited 1377507172
Hrm, this type of script should not be allowed since it can be used by the GM to listen in on whispers between players.
1377508809
Lithl
Pro
Sheet Author
API Scripter
Well, I may not want to play with a GM that's listening in on every whisper, but on the other hand the only way to prevent this is to not expose the API to chat events on a whisper, which closes doors to other, less shady, potential scripts. On the other other hand, I generally stick to voice chat and use whispers for system/error messages dealing with my own scripts. /me shrugs
I've already sent a message to Riley. Whispers should not be accessible to the GM via any means, regardless of any potential that may or may not have.
HoneyBadger - oh I fully agree! Like I said in my top post, this is not a script I'll actually be using in my campaign, it's me learning the api to make real scripts in the future. A DM listening in on whispers without his players knowledge would be a huge betrayal of trust - though to be fair, if GM and players all agreed in advance, it's not harming anyone, eh? Me and my friends are discussing setting up a Diplomacy variant on Roll20, which requires the omnipotent controller to overhear everyone's discussions - for that I think it could be pretty handy, easier than setting up...what, 8 seperate chat groups :)
You can do this in Roll20 w/o any scripting by creating 8 player handouts and giving edit/control access to one journal for each player and all of them to the GM. Players would then /w the journal name assigned to that player rather than the name of the player. The GM will see these whispers.
1377520109

Edited 1377520243
Aye; however for the Diplomacy game, anyone can set up "Secret Meetings" with anyone else - that ends up being a lot of handouts! As that's the only whispering in such a game to begin with, I see no reason not to use a script similar to that when/if we get the Diplomacy game going. But like I said, absolutely wouldn't run this without player knowledge, that wouldn't be cool. But anyway, I just came here to find out why my script wasn't working, which I now know and have fixed - Thanks for the help Emile and Brian!
1377521346
Bill K.
Pro
Sheet Author
You know, this is actually one of my bigger problems with online tabletop: the inability to guarantee that the GM hears what the players say.  Not to listen in about actual, honest to goodness private stuff, but consider the sheer number of ways NPCs have to eavesdrop on players  - scrying.  Listening bugs.  Telepathy.  Any number of instances require a GM to know what the players are talking about without telling them 'uh, hey, I need you to have your private chats public for the next, oh, 20 minutes or so'. The problem being, of course, the moment a player realizes that he or she was overheard by an NPC (often standing 5 feet away, while the PC discusses killing said for some imagined slight), they start opening private skype chats or the like.  Not something you can do when sitting at an actual table - you can ACTUALLY whisper, but anything audible becomes detectable. And, admittedly, you can always just have the NPCs be a bit more prepared for whatever the PCs try, on the fly, but that's not exactly an ideal solution, since it denies them the ability to feed false information.  Alas, the problems of online play.
Aye, I actually had exactly such a problem recently - an NPC of mine can technically listen to peoples thoughts; fortunatly my players are good at not meta-gaming, so we generally just worked it out. Thats a point though - as the players would know their whispers were seen by the game controller, we all have the rest of the group on Skype anyway, so if they needed to make a genuinely private message for any reason, they could easily use that. Good idea - I must mention it to my group!
You don't need to know their plans ahead of time. You adjust on the fly if the npc's would have had a chance to overhear.
I dunno. It seems to me like People are overly concerned about their GMs hearing whispers. This might just be opinion, but I would never say anything on roll20 I didn't want the GM to know. If I found out my players were trying to pull something shiesty, I'd kill them with a large sky boulder.
Haha - I do the same thing; I said at the start of the game - "I catch you doing something you shouldn't, lightning bolt! I have the red mana dammit!" ...turns out they're just a super good group anyway, but didn't hurt to warn! I also don't put anything super sensitive in whispers, but that's just because too many times have I missed the / key and just sent a chat message to everyone....
Quote=Emile L: " I would never say anything on roll20 I didn't want the GM to know" Really, Emile? Really ? q;} Seriously tho, it should be up to the GM and the players to be honest and not meta-game! However, in other online tabletops I've used, the GM does hear every whisper; I was surprised to learn this one doesn't have that, even as an option. I can understand the players not being able to avoid meta-gaming, but the GM really should know when to keep 'private' knowledge private. My personal preference is that the GM should hear everything; (s)he is 'god' after all!  Of course, this being the intrawebz, there's all kinds of ways around it, as was mentioned previously. I guess this is one of those things we'll never get everyone to agree on, but it's good to have the discussion!
1377531721

Edited 1377531764
Yeah, and If you're concerned about the "power" of this script, maybe you shouldn't be playing in a group where you don't trust the GM... I understand that in a group, sometimes you want to send a chat to another player privately. But it should never be something that the GM should be in the dark about. Just things you may/may not want other players in the group to know.
GM's are not god. I am so fucking sick of people saying that stupid shit... it's ridiculous. The GM is just an arbitrator / moderator of the game.
Another thing we'll never get everyone to agree about, HoneyBadger.
1377532164
Gid
Roll20 Team
Guys, lets keep this on topic. We're talking about how to get a certain script to work. If a user wants Roll20 to function in a certain way (in this instance, whispers) that is exactly what the API feature was meant to do. This is NOT where we discuss whether a user/group should or shouldn't be using a script for their game.
The problem here Kristin, is that a player in a game won't know that their whispers are being monitored.
1377538397

Edited 1377538533
Gid
Roll20 Team
After a second read through, it looks like the OP figured out their script issue. I'm locking the thread down because this went way off-topic. Questioning the purpose or a need of a particular script is not what the API Forum is for. Whether this is something the Devs want allowed is up to them to decide and arguing about whether it is or isn't here in the forums is pointless. I repeat: This forum is NOT for discussion on whether a user/group should or shouldn't be using a script for  their  game.