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] QuickSpeak

Hey! Basically, this let's someone speak as someone else. Use Commands !qset - Type !qset NAME HERE | MESSAGE HERE || Notes Messing up the writing in !qset at the moment will not detect if you fail. If you were to type, persay "!qset Urist McUriston| I want that sock ||" ALL SCRIPTS WILL BE DISABLED! I tried lots of things to fix this, and none of them worked. If anyone has a check that will fix this, I will happily include it. Plans I plan to release a slot system, which records a name inside a slot. Meaning you do not have to write the name every time you want to write as that character. I also plan to include a typo friendly system. on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!qset ") !== -1) { var split1 = msg.content.split(/\s+/); var name = ""; var count = 2; var check = true; count = split1.indexOf(name) while (count != split1.indexOf("|")) { var whatisreads = split1[count] var start = split1[1] if(whatisreads == null || whatisreads == "!qset") { count++ } else { if (previoustorage == null) { name = whatisreads; count++; } else { name = previoustorage + " " + whatisreads; count++ } var previoustorage = name; log("Name = " + previoustorage) log(count) } } name = previoustorage; log("The name is " + name) count = count + 1; var activechecker = false; while(count != split1.indexOf("||")) { if(activechecker == false) { var previousmessage = split1[count]; activechecker = true; count++ log(previousmessage) } else { var currentmessage = previousmessage + " " + split1[count]; previousmessage = currentmessage; log(previousmessage) count++ } } sentmessage = previousmessage; sendChat(name, sentmessage) } })
You could change the format to something like the actual /as and /emas commands... where the first word or words in quotation marks are used as the name. !as Thor Bring me me another. !emas "Thor Thunderstrike" leaps down from the balcony and smashes his hammer into the ground.
I suggest wrapping the name in a span tag and use the title attribute to set the original sender name. That way anyone can mouseover the name and see who actually sent it.