Well, I can finally release a beta. It should have BASIC functionality. I have tested it in both Main and NewGrounds.
Before you proceed, read the following warning:
The chat program uses the Ingame PM system. As I found out through testing, there is a limit as to how many Ingame PMs can be sent per day. After reaching the maximum (I was unable to count, but it is a lot), you will be unable to send ingame PMs until the following day. This also means that the chat will stop working, since it uses ingame PMs.
All right, now that you are ready to use the chat, here are the set up instructions:
1. Add the following code to your personal log:
Code: Select all
<a href=bank.php?strErr=%3Cdiv%3E%3Ctextarea%20onkeyup=this.nextSibling.nextSibling.innerHTML=this.value%3E%3C/textarea%3E%3Cbr%3E%3Cdiv%3E%3C/div%3E%3C/div%3E>Program Launcher</a>
2. A link will appear in your personal log called "Program Launcher". Click on it.
3. The link takes you to your bank. You will notice a text box in your bank, near the top. We need to paste the chat program's code in order to proceed. The code is in the spoiler below:
[spoiler]
Code: Select all
Player ID:<input type='text' value='' id='fid' /><input type='button' value='Start Chat' onclick="eval(this.nextSibling.value)" /><textarea style='display:none'>var fid=document.getElementById('fid').value;var chatW = window.open('','_blank','width=340,height=401,resizable=no');chatW.document.write("<head><title>PookaChat - Chat with "+fid+"</title></head><body style='background:black;color:white;'><div id='abc' style='width:100%;padding:10px;position:absolute;left:0px;top:0px;overflow:auto;height:320px;border-bottom:1px solid grey;'></div><br><div style='position:absolute;left:0px;top:341px;width:100%;border-bottom:1px solid grey;'><textarea id='sam' onkeyup=\"sendit(event);\" placeholder='[Type here to chat...]' style='width:280px;height:60px;resize:none;background:#000;color:#fff;border:none;'></text"+"area><input onclick=\"sendMsg(J('sam').eid.value);J('sam').eid.value='';\" type='button' value='Send' style='position:absolute;right:0px;bottom:0px;width:60px;height:60px;border:1px solid grey;'/></div><script>var sid=0,fid="+fid+";function obj(id) {this.eid = document.getElementById(id);this.html = function(b){if (b) {this.eid.innerHTML = b;}return this.eid.innerHTML;};}function J(a) {return new obj(a);}function handle(a,b,c) {if (!b) {getMsg('out');}else if (b===1) {idSelf(a);}else if (b===2) {msgGet(a,c);}}function get(a,b,c) {var xmlhttp;if (window.XMLHttpRequest) {xmlhttp=new XMLHttpRequest();xmlhttp.open('GET',a,true);xmlhttp.send();}xmlhttp.onreadystatechange=function() {if (xmlhttp.readyState==4 && xmlhttp.status==200) {handle(xmlhttp.responseText,b,c);}}}function selfID() {get('base.php',1);}function idSelf(a) {sid = a.replace(/[^A-z0-9<>]/gi,'');sid = sid.match(/statsphpid[0-9]{1,}/);sid = sid[0].replace(/[^0-9]/gi,'');}selfID();function sendMsg(smsg) {if (sid!=0 && smsg){get('writemail.php?to='+fid+'&subject='+sid+':XG:'+fid+':XG:'+smsg+'&send=Send',0,0);}}function getMsg(a) {get('inbox.php?page='+a+'box',2,a);}function msgGet(a,b) {if (b==='in') {var col = '#380000';} else if (b==='out') {var col = '#000066';}var patt = new RegExp('( TITLE=\042view message\042)|(&page='+b+'box&type=view)','gi');var msgs=a.replace(patt,'').replace(/\\\\042/g,'&qu"+"ot;').replace(/\\s*<\\/FONT>\\s*<\\/TD>\\s*<TD>\\s*<FONT COLOR=\042[A-z0-9#]{3,}\042>\\s*/gi,''),mid=[],mtxt=[],n=[];msgs=msgs.match(/inbox.php\\?id=\\d{5,}\042>\\s{1,}\\d{1,}:XG:\\d{1,}:XG:.{2,140}<\\/A>[A-z0-9:,\\s]{3,9}/gi);for (var i=0;i<msgs.length;i++) {mid[i] = msgs[i].match(/inbox.php\\?id=\\d{1,}/);mid[i] = mid[i][0].replace(/\\D/g,'');mtxt[i] = msgs[i].match(/\\d{1,}:XG:\\d{1,}:XG:[^<]{1,161}<\\/A>[A-z0-9:,\\s]{3,9}/gi);mtxt[i] = mtxt[i][0].replace(/\\s<\\/A>/gi,':XG:');n[i] = mtxt[i].split(':XG:');get('inbox.php?id='+mid[i]+'&type=del&page='+b+'box',0,0);}for (var i=msgs.length-1;i>=0;i--) {J('abc').eid.innerHTML += \"<div style='background:\"+col+\";width:300px;padding:5px;border-radius:4px'><div style='float:left;'><a style='color:#fff;' href='stats.php?id=\"+n[i][0]+\"' target='_blank'>\"+n[i][0]+\"</a> says:</div><div style='float:right;color:grey;'><i>\"+n[i][3]+\"</i></div><br><div style='margin-left:30px;font-size:0.9em;'>\"+n[i][2]+\"</div></div><br>\";}J('abc').eid.scrollTop = J('abc').eid.scrollHeight;}function sendit(e){if (e.which === 13){sendMsg(J('sam').eid.value);J('sam').eid.value='';return false;}}setInterval(function(){getMsg('in');},5000);</script></body>");</textarea>
[/spoiler]
4. Below the text box, a launcher will appear. It will ask you for the ID of the player with whom you would like to chat. Type it in and then press "Start Chat". The rest should be self-evident.
Note: The player will need to be online and have an open chat window with your ID in order to receive your chats live. Otherwise, they will receive an ingame PM for each chat and that PM will contain your player ID and theirs. If you like, you can type in your own player ID. This will allow you to test out the basic functionality. Blue bubbles represent messages that you have sent. Red bubbles represent messages that you have received.
Also, note that if you receive a chat from a different player while in a chat with a player, you will probable see it in the same window, but if you respond there, you will be responding to the player with whom you started the chat. This is a very fixable issue, but this is a beta and I'm just having fun here...
Toodles,
Pooka