First of all I'd like to say, very belatedly, thank you to The Aaron and William C. for comments in my FP Dungeon script. I'm still working on it but put it on the back burner to get this done. Now, I have modified a script I found that was used for creating a waiting screen text and using rollable tables I have been able to create a very simple method of having players and GM use the chat bar but have it pop up like in a JRPG. However, the script isn't elegant enough to deal with multiple people spamming it. I was wondering if the wizards here would know of a good way to solve this problem. I'm thinking I need to have a separate script that will ingest all the chat logs using the "!say" tag and store it into a list (a state) that will be accessed by the script I currently have. The current script would need a for loop to iterate through the list and then once gone through an element, grab an updated version of the list, and then remove the currently held loop element. For this idea, im not sure its the most efficient or if javascript has the means to do this the way I imagine (I think in python). So what do you all think? (this is how it works right now. type !say anything and it will read the ID of the chat, use a rollable table to display your icon, and then generate text on the object I have on the GM layer before removing themselves after some time.) Code: on("ready",function(){ state.charText = undefined; on("chat:message",function(msg){ //'use strict'; //var players=findObjs({_type:'player'}); //_.each(players,function (obj){ //sendChat(sendingPlayer, 'Player '+obj.get('displayname')+' has id: '+obj.get('id')) //log('Player '+obj.get('displayname')+' has id: '+obj.get('id')); //}); //log("start"); //Need to make a buffer for text. var chatLog = []; var textBox; var curToken = findObjs({ type:"graphic", }); var sendingPlayer = msg.playerid; if(msg.type=="api" && msg.content.indexOf("!say")==0){ log(sendingPlayer); pageid:Campaign().get("playerpageid"); var token = findObjs({ name:"chatBitch", type:"graphic", pageid:Campaign().get("playerpageid") }); var textLocation = token[0]; var InputString = msg.content.replace('!say', ''); var time = 6000; //TRYING TO PUT CHAT TO LIST var textMSG = sendingPlayer + ":" var userTEXT = textMSG.concat(' ', InputString); chatLog.push(userTEXT) //Add text to list //NEED TO ADD FOR LOOP TO GO THROUGH THE LIST AND THEN DELETE CONTENT AFTER SHOWING if (!state.charText){ log("!state.charText"); //log(!state.charText); var topOffest = textLocation.get("top") - 1; sendChat(sendingPlayer, sendingPlayer); var textBox = createObj("text", { text:InputString, font_size:36, font_family:"Contrail One", color:"rgb(0,0,0)", layer:"objects", pageid:Campaign().get("playerpageid"), left:textLocation.get("left"), top:topOffest }); log("state.charText iddddd"); state.charText = { module:"Old_School_Dungeon_Test", textID:textBox.get("id") }; log(sendingPlayer); log('sendingPlayer'); if (sendingPlayer == "-Mtjru7YtFnNCi18v8Fp"){ sendChat(sendingPlayer, "George Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|1 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } if (sendingPlayer == "-MteTpkfNZ7TbJwvD0Rt"){ sendChat(sendingPlayer, "Brian Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|3 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } if (sendingPlayer == "-My00c7Dtfov7FRk-Og0"){ sendChat(sendingPlayer, "Sean Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|4 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } if (sendingPlayer == "-N-owesO58dLMiomCvih"){ sendChat(sendingPlayer, "Ricco Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|2 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } if (sendingPlayer == "-MtdanhLJHL8GqdQxG2B"){ sendChat(sendingPlayer, "GM Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|6 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } if (sendingPlayer == "-N-owexBvjBD-73Fx2p_"){ sendChat(sendingPlayer, "D Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|7 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } if (sendingPlayer == "-My00i1Dc_awKRg9kcGu"){ sendChat(sendingPlayer, "EuroTom Talked");
sendChat(sendingPlayer, "!token-mod --set currentside|5 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } } log("TimeOut"); setTimeout(function() { if(textBox!==undefined){ textBox.remove();
sendChat(sendingPlayer, "!token-mod --set currentside|8 --api-as
-MiHnsx-c60LH76XSwZc --ids -N1xoywZ8bX8AUmjB9SQ"); } state.charText = undefined; log("ChatText"); }, time); log("endMain"); } //else //{ //log('elsed') //textBox = getObj("text",state.charText.textID); //} }); on("chat:message",function(msg){ if(msg.type=="api" && msg.content.indexOf("!clearText")==0){ log("CHAT:MESSAGE"); textBox = getObj("text",state.charText.textID); if(textBox!==undefined){ textBox.remove(); } state.charText = undefined; } }); msg.content = _.chain(msg.inlinerolls) .reduce(function(m,v,k){ m['$[['+k+']]']=v.results.total || 0; sendChat('', "return m"); return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },msg.content) .value(); });