---Thread Necro---
This is something that I want to know as well. I've seen it in the pictures. And I see it in the chatform.htm. But I have not been able to get it in either the GM chat or the Player chat windows. Please Help.
It requires a little javascript modification to the dice buttons and to add the dropdown or a textbox (Modifications should work on lite version too) .. I'll see what i can do this week.
I've bought the program some years ago, and we finally had our first game online last saturday (SW Saga) ! It worked well with audio in Skype...
I'll need to review the chat and map update scripts thou, cause people complained that it did not update unless they move / type ...
But it was far better than only with skype.
With version 1.6 supporting transparent background for token, it was really nice.
Now, I can finally work on my vbs scripts (full version only).
It should do the trick. Please note that I'm not the original author of this code. All merit goes to "Soda" Bob Curtis. I simply borrowed it and made it my own. Don't forget to backup the file just in case something goes wrong.
Similarly, if you want the same dice roller in your GM screen, edit the chatgm.htm file in your Default folder and just replace :
<div id=chatsubmit name=chatsubmit style='background: #FFFFFF; border: thin #777777 dotted; position: absolute; top: 590; left: 10; width: 100%; height: 100; overflow: auto; padding: 2; filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=6, OffY=6, Color='gray', Positive='true')'>
<input type=text name=chattext id=chattext size=35 style='border: thin solid black;' onkeydown='return submitOnReturn( event);'>
<input type=submit value='say' onclick='submitChat();'><br>
<div name=dicebuttons id=dicebuttons>
</div>
</div>
<!--- Fill this with a sound tag to play it. put it off screen so that the browser doesnt 'flash' when the <embed> tag is put in -->
<div name=soundplay id=soundplay style='position: absolute; left:-2000; top:-1000;width:10;'>
</div>
<script type='text/javascript' src='ui/advanced/advancedui.js'></script>
<script language=JavaScript>
// customize
var ChatFreqSeconds = 4;
//
var isIE = isIE();
ChatFreq = ChatFreqSeconds * 1000;
var LastChatSubmit = '';
var ChatButtons = new Array();
PlayerName = '%%PLAYER%%';
PlayerE = '%%PLAYER_E%%'
PasswordE = '%%PASSWORD_E%%';
PlayerPass = '&player=%%PLAYER_E%%&password=%%PASSWORD_E%%';
setTimeout( "getNewChat( chatlog, true)", 1000);
//preload some images
var imgSmiley1 = new Image(); imgSmiley1.src="http://www.screenmonkeyplanet.com/ui/advanced/smiley1.gif";
var imgSmileyGrin = new Image(); imgSmileyGrin.src="http://www.screenmonkeyplanet.com/ui/advanced/smileygrin.gif";
var imgSmileySad = new Image(); imgSmileySad.src="http://www.screenmonkeyplanet.com/ui/advanced/smileysad.gif";
var imgSmileyTongue = new Image(); imgSmileyTongue.src="http://www.screenmonkeyplanet.com/ui/advanced/smileytongue.gif";
var imgSmileyWink = new Image(); imgSmileyWink.src="http://www.screenmonkeyplanet.com/ui/advanced/smileywink.gif";
window.onload = pageLoaded;
function pageLoaded()
{
window.onresize = doResize;
doResize();
}
function doResize()
{
var w = document.body.clientWidth - 32;
var h = document.body.clientHeight - 32;
chatlog.style.height = h - 100;
chatsubmit.style.top = getNumSize(chatlog.style.top) + getNumSize( chatlog.style.height) +5;
}
function getNewChat( that, bTimerOn)
{
var xr = getXrequest();
//add a timestamp to bust the cache. Otherwise the browser may just reuse the
//last results from the same URL. Particularly if the request fails.
var sUrl = "screenmonkey.cgi?action=63" + PlayerPass + "&ts=" + getTimeStamp();
xr.open("GET", sUrl, true);
xr.onreadystatechange=function()
{
if (xr.readyState==4)
{
window.status=xr.statusText;
doChatUpdate( that, xr);
if (bTimerOn == true)
{
setTimeout("getNewChat( chatlog, true)", ChatFreq);
}
}
}
xr.setRequestHeader ("content-type", "text/plain");
sendXrequest( xr)
}
function doChatUpdate( that, x)
{
//parse for various command sent from server
var s = x.responseText;
//smileys - pull them off the SMP.com server
//no need to on gm's machine
if (s.indexOf( 'smiley') > -1)
{
// s = s.replace( /img src="smiley1.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smiley1.gif"');
// s = s.replace( /img src="smileygrin.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileygrin.gif"');
// s = s.replace( /img src="smileysad.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileysad.gif"');
// s = s.replace( /img src="smileytongue.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileytongue.gif"');
// s = s.replace( /img src="smileywink.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileywink.gif"');
}
//sound
if ( s.indexOf( '#playsound( ') > -1)
{
s = getSoundTag( s);
}
//away
that.innerHTML = that.innerHTML + s;
window.scrollTo(0,999999999);
that.scrollTop = 9999999;
}
function submitChat()
{
LastChatSubmit = chattext.value;
//are we adding a button?
var s = chattext.value;
if (s.substr(0, 4).toLowerCase() == '#add')
{
var cmd = s.substr( 5);
addChatButton( cmd);
chattext.value = '';
return;
}
if (s.substr(0, 7).toLowerCase() == '#remove')
{
var cmd = s.substr( 8);
removeChatButton( cmd);
chattext.value = '';
return;
}
if (s.substr( 0, 6).toLowerCase() == '#clear')
{
chatlog.innerHTML = '';
chattext.value = '';
return;
}
//submit the chat
var xr = getXrequest();
s = URLEncode( chattext.value);
//s = escape( chattext.value);
//get a time stamp to add to the url so that the browser doesnt cache the request
var ts = getTimeStamp();
var sUrl = "screenmonkey.cgi?action=62" + PlayerPass + "&chattext=" + s + "&ts=" + ts;
chattext.value = '';
//alert( sUrl);
xr.open("GET", sUrl, true);
xr.onreadystatechange=function()
{
if (xr.readyState==4)
{
window.status=xr.statusText;
getNewChat( chatlog, false);
//xr.abort();
}
}
xr.setRequestHeader ("content-type", "text/plain");
sendXrequest( xr)
}
function submitOnReturn( ev)
{
//if (window.event.keyCode == 13)
if (ev.keyCode == 13)
{
//window.event.keyCode = 0; // Kill the keyboard message
submitChat();
ev.keyCode = 0; // Kill the keyboard message
return false; // Cancel the onKeyDown event
}
if (ev.keyCode == 38)
{
chattext.value = LastChatSubmit;
}
}
function addChatButton( cmd)
{
//do some escaping on cmd
var lab = cmd;
if ( cmd.length > 10)
{
lab = cmd.substring( 0, 10) + '...';
}
lab = lab.replace(/'/g, "\\'");
cmd = cmd.replace(/'/g, "\\'");
var b = "<input type=submit value='" + lab + "' onclick=\"chattext.value = '" + cmd +"'; submitChat()\">";
ChatButtons.push( b);
buildChatButtons();
}
function buildChatButtons()
{
var s = '';
var n = ChatButtons.length;
var i = 0;
for (i = 0; i < n; i++)
{
s = s + ChatButtons[i];
}
dicebuttons.innerHTML = s;
}
function removeChatButton( n)
{
var i = parseInt( n);
i = i -1; // to make it easier to use, let the user index buttons starting at 1
if ((i > -1) && (i < ChatButtons.length))
{
ChatButtons.splice( i, 1);
}
buildChatButtons();
}
function getSoundTag( s)
{
var n = s.indexOf( '#playsound(');
if (n > -1) //and it should be
{
var s2 = s.substr( n +11, s.length);
var n2 = s2.indexOf( ')');
if (n2 > -1)
{
s2 = s2.substr( 0, n2);
playSound( trim( s2));
s = s.substr( 0, n) + s.substr( n + 11 + n2 +1, s.length);
}
}
return s; //return the string without the tag
}
function playSound( sound)
{
var url = '';
//is this a direct http link?
if ( sound.substr( 0, 7).toLowerCase() == 'http://')
{
url = trim( sound); //all's included, so dont add anything to the url
}
else
{
if (sound.substr( 0, 4).toLowerCase() == 'www.')
{
url = 'http://' + trim( sound); //just add the http://
}
else
{
if ((sound.toLowerCase().match( '.wav')) || (sound.toLowerCase().match( '.mp3')))
{
url = "sounds/" + trim( sound); //use as-is, send to dounds dir
}
else
{
url = "sounds/" + trim( sound) + ".wav"; //default to wav ext, send it to sounds dir
}
}
}
url = trim( url);
soundplay.innerHTML = "<embed src='" + url + "' hidden=true autostart=true>";
}
</script>
</body>
</html>
With the following code :
<div id=chatsubmit name=chatsubmit style='background: #CCCCCC; border: thin #777777; position: absolute; top: 590; left: 10; width: 100%; height: 100; overflow: auto; padding: 2;'>
<form name="chatform" id="chatform">
<table align="right" cellpadding=0 cellspacing=0 border=0>
<tr>
<td colspan="2">
<input type=text name=chattext id=chattext size=28 style='border: thin solid black;' class="inputtext" onkeydown='return submitOnReturn( event);'>
</td>
<td>
<input type=button value='say' style="width:43;" class="inputbutton" onclick='submitChat();'>
</td>
</tr>
<tr>
<td colspan="3" bgcolor="#000000" height="2">
</td>
</tr>
<tr>
<td width="160" align="right" nowrap>
<input type="text" name="dienumber" size="2" value="1" class="inputnumber">
<select name="die" class="inputtext" onchange="changeDie();">
<option value="2">    d2
<option value="3">    d3
<option value="4">    d4
<option value="6">    d6
<option value="8">    d8
<option value="10">  d10
<option value="12">  d12
<option value="20" selected>  d20
<option value="100">d100
</select>
+
<input type="text" name="numberplus" size="2" value="0" class="inputnumber">
</td>
<td>
<input type=button name="roll" value="Roll" style="width:43;" class="inputbutton" onclick="formDie(); submitChat();"><br>
<input type=button name="roll" value="Insert" style="width:43;" class="inputbutton" onclick="formDie();">
</td>
</tr>
<!--<tr>
<td nowrap>
<input type="button" name="roll" value="Roll" class="contentarea_inputbutton" onclick="rollIt();">
</td>
</tr>-->
</table>
</form>
<p style="margin-top: 7"> </p>
<p style="margin-top: 7"> </p>
<!-- submitChat();-->
<div name=dicebuttons id=dicebuttons>
</div>
</form>
</div>
<!--- Fill this with a sound tag to play it. put it off screen so that the browser doesnt 'flash' when the <embed> tag is put in -->
<div name=soundplay id=soundplay style='position: absolute; left:-2000; top:-1000;width:10;'>
</div>
<script type='text/javascript' src='ui/advanced/advancedui.js'></script>
<script language=JavaScript>
<!--
var chattextRef = document.getElementById('chattext');
// customize
var ChatFreqSeconds = 4;
//
var isIE = isIE();
ChatFreq = ChatFreqSeconds * 1000;
var LastChatSubmit = '';
var ChatButtons = new Array();
PlayerName = '%%PLAYER%%';
PlayerE = '%%PLAYER_E%%'
PasswordE = '%%PASSWORD_E%%';
PlayerPass = '&player=%%PLAYER_E%%&password=%%PASSWORD_E%%';
setTimeout( "getNewChat( chatlog, true)", 1000);
//preload some images
var imgSmiley1 = new Image(); imgSmiley1.src="http://www.screenmonkeyplanet.com/ui/advanced/smiley1.gif";
var imgSmileyGrin = new Image(); imgSmileyGrin.src="http://www.screenmonkeyplanet.com/ui/advanced/smileygrin.gif";
var imgSmileySad = new Image(); imgSmileySad.src="http://www.screenmonkeyplanet.com/ui/advanced/smileysad.gif";
var imgSmileyTongue = new Image(); imgSmileyTongue.src="http://www.screenmonkeyplanet.com/ui/advanced/smileytongue.gif";
var imgSmileyWink = new Image(); imgSmileyWink.src="http://www.screenmonkeyplanet.com/ui/advanced/smileywink.gif";
//base chat buttoons
window.onload = pageLoaded;
function pageLoaded()
{
window.onresize = doResize;
doResize();
}
function doResize()
{
var w = document.body.clientWidth - 32;
var h = document.body.clientHeight - 32;
chatlog.style.height = h - 100;
chatsubmit.style.top = getNumSize(chatlog.style.top) + getNumSize( chatlog.style.height) +5;
}
function getNewChat( that, bTimerOn)
{
var xr = getXrequest();
//add a timestamp to bust the cache. Otherwise the browser may just reuse the
//last results from the same URL. Particularly if the request fails.
var sUrl = "screenmonkey.cgi?action=63" + PlayerPass + "&ts=" + getTimeStamp();
xr.open("GET", sUrl, true);
xr.onreadystatechange=function()
{
if (xr.readyState==4)
{
window.status=xr.statusText;
doChatUpdate( that, xr);
if (bTimerOn == true)
{
setTimeout("getNewChat( chatlog, true)", ChatFreq);
}
}
}
xr.setRequestHeader ("content-type", "text/plain");
sendXrequest( xr)
}
function doChatUpdate( that, x)
{
//parse for various command sent from server
var s = x.responseText;
//smileys - pull them off the SMP.com server
//no need to on gm's machine
if (s.indexOf( 'smiley') > -1)
{
// s = s.replace( /img src="smiley1.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smiley1.gif"');
// s = s.replace( /img src="smileygrin.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileygrin.gif"');
// s = s.replace( /img src="smileysad.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileysad.gif"');
// s = s.replace( /img src="smileytongue.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileytongue.gif"');
// s = s.replace( /img src="smileywink.gif"/g, 'img src="http://www.screenmonkeyplanet.com/ui/advanced/smileywink.gif"');
}
//sound
if ( s.indexOf( '#playsound( ') > -1)
{
s = getSoundTag( s);
}
//away
that.innerHTML = that.innerHTML + s;
window.scrollTo(0,999999999);
that.scrollTop = 9999999;
}
function submitChat()
{
LastChatSubmit = chattextRef.value;
//are we adding a button?
var s = chattextRef.value;
if (s.substr(0, 4).toLowerCase() == '#add')
{
var cmd = s.substr( 5);
addChatButton( cmd);
chattextRef.value = '';
return;
}
if (s.substr(0, 7).toLowerCase() == '#remove')
{
var cmd = s.substr( 8);
removeChatButton( cmd);
chattextRef.value = '';
return;
}
if (s.substr( 0, 6).toLowerCase() == '#clear')
{
chatlog.innerHTML = '';
chattextRef.value = '';
return;
}
//submit the chat
var xr = getXrequest();
s = URLEncode( chattextRef.value);
//s = escape( chattextRef.value);
//get a time stamp to add to the url so that the browser doesnt cache the request
var ts = getTimeStamp();
var sUrl = "screenmonkey.cgi?action=62" + PlayerPass + "&chattext=" + s + "&ts=" + ts;
chattextRef.value = '';
//alert( sUrl);
xr.open("GET", sUrl, true);
xr.onreadystatechange=function()
{
if (xr.readyState==4)
{
window.status=xr.statusText;
getNewChat( chatlog, false);
//xr.abort();
}
}
xr.setRequestHeader ("content-type", "text/plain");
sendXrequest( xr)
}
function submitOnReturn( ev)
{
//if (window.event.keyCode == 13)
if (ev.keyCode == 13)
{
//window.event.keyCode = 0; // Kill the keyboard message
submitChat();
ev.keyCode = 0; // Kill the keyboard message
return false; // Cancel the onKeyDown event
}
if (ev.keyCode == 38)
{
chattextRef.value = LastChatSubmit;
}
}
function addChatButton( cmd)
{
//do some escaping on cmd
var lab = cmd;
if ( cmd.length > 10)
{
lab = cmd.substring( 0, 10) + '...';
}
lab = lab.replace(/'/g, "\\'");
cmd = cmd.replace(/'/g, "\\'");
var b = "<input type=submit value='" + lab + "' onclick=\"chattextRef.value = '" + cmd +"'; submitChat()\">";
ChatButtons.push( b);
buildChatButtons();
}
function buildChatButtons()
{
var s = '';
var n = ChatButtons.length;
var i = 0;
for (i = 0; i < n; i++)
{
s = s + ChatButtons[i];
}
dicebuttons.innerHTML = s;
}
function removeChatButton( n)
{
var i = parseInt( n);
i = i -1; // to make it easier to use, let the user index buttons starting at 1
if ((i > -1) && (i < ChatButtons.length))
{
ChatButtons.splice( i, 1);
}
buildChatButtons();
}
function getSoundTag( s)
{
var n = s.indexOf( '#playsound(');
if (n > -1) //and it should be
{
var s2 = s.substr( n +11, s.length);
var n2 = s2.indexOf( ')');
if (n2 > -1)
{
s2 = s2.substr( 0, n2);
playSound( trim( s2));
s = s.substr( 0, n) + s.substr( n + 11 + n2 +1, s.length);
}
}
return s; //return the string without the tag
}
function playSound( sound)
{
var url = '';
//is this a direct http link?
if ( sound.substr( 0, 7).toLowerCase() == 'http://')
{
url = trim( sound); //all's included, so dont add anything to the url
}
else
{
if (sound.substr( 0, 4).toLowerCase() == 'www.')
{
url = 'http://' + trim( sound); //just add the http://
}
else
{
if ((sound.toLowerCase().match( '.wav')) || (sound.toLowerCase().match( '.mp3')))
{
url = "sounds/" + trim( sound); //use as-is, send to dounds dir
}
else
{
url = "sounds/" + trim( sound) + ".wav"; //default to wav ext, send it to sounds dir
}
}
}
url = trim( url);
soundplay.innerHTML = "<embed src='" + url + "' hidden=true autostart=true>";
}
// Funky Dice Roller 1.0 (C) 2005 by "Soda" Bob Curtis
// Modified for use with Screen Monkey chat by "Soda" Bob Curtis
// See: http://www.sodabob.com/roleplay/ for the fully javascript dice roller
// Permission granted to use or modify for all non-profit
// websites or with Screen Monkey, so long as this copyright notice remains.
var diepicRef = document.getElementById('diepic');
var numberRef = document.getElementById('dienumber');
var numberplusRef = document.getElementById('numberplus');
var dieRef = document.getElementById('die');
function formDie() {
//chattextRef.value = '{' + numberRef.value + 'd' + dieRef.value + '+' + numberplusRef.value + '}';
chattextRef.value = chattextRef.value + '{' + document.chatform.dienumber.value + 'd' + document.chatform.die.value + '+' + document.chatform.numberplus.value + '}';
}
function changeDie() {
dieimage = 'ui/sodabob/d' + dieRef.value + '.jpg';
//alert(dieimage);
diepicRef.src=dieimage;
}
function findDOM(objectId) {
if (document.getElementById) {
return (document.getElementById(objectId));
}
if (document.all) {
return (document.all[objectId]);
}
}
function zoom(type,imgx,sz) {
imgd = findDOM(imgx);
if (type=="+" && imgd.width < 175) {
imgd.width += 2;imgd.height += (2*sz);
}
if (type=="-" && imgd.width > 20) {
imgd.width -= 2;imgd.height -= (2*sz);
}
}
function myZoom(imgx,percent) {
imgd = findDOM(imgx);
imgd.width = percent;
imgd.height = percent;
}
//-->
</script>
</body>
</html>
Comments
This is something that I want to know as well. I've seen it in the pictures. And I see it in the chatform.htm. But I have not been able to get it in either the GM chat or the Player chat windows. Please Help.
Tad
I've bought the program some years ago, and we finally had our first game online last saturday (SW Saga) ! It worked well with audio in Skype...
I'll need to review the chat and map update scripts thou, cause people complained that it did not update unless they move / type ...
But it was far better than only with skype.
With version 1.6 supporting transparent background for token, it was really nice.
Now, I can finally work on my vbs scripts (full version only).
Tad
Tad
Edit the main.htm file in your UI folder and just replace :
With the following code :
It should do the trick. Please note that I'm not the original author of this code. All merit goes to "Soda" Bob Curtis. I simply borrowed it and made it my own. Don't forget to backup the file just in case something goes wrong.
MX
With the following code :
Enjoy!
MX
The current headings are: Chat style, Dice Manipulation, Dice Output, Turn Manager, Character Sheet, Audio Player, Movie Output, Fog of War and Vision