Shoutbox

what doesn't work? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: what doesn't work? (/showthread.php?tid=65462)

what doesn't work? by kris2000 on 08-27-2006 at 11:06 AM

what doesn't work with this script?

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin,Message,MessageKind)
{
    if (Message == "test1") {
        WriteString(0, "test");
    }
    if (Message == "test2") {
        MsgPlus.DisplayToast("TEST", ReadString(0));
    }
}


RE: what doesn't work? by Ash_ on 08-27-2006 at 11:11 AM

try this.

code:
var x;

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin,Message,MessageKind)
{
if (Message == "test1") {
x="test";
}
if (Message == "test2") {
MsgPlus.DisplayToast("TEST", x);
}
}



dont have time to test it right now but that should work. :D

if you really wanna use the WriteString call try this.
code:
var x;

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin,Message,MessageKind)
{
if (Message == "test1") {
x.WriteString(0, "test");
}
if (Message == "test2") {
MsgPlus.DisplayToast("TEST", x.ReadString(0));
}
}


RE: what doesn't work? by kris2000 on 08-27-2006 at 11:31 AM

Thank you, but it doesn't work

code:
var x;

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin,Message,MessageKind)
{
if (Message == "test1") {
x.WriteString(0, "test");
}
if (Message == "test2") {
MsgPlus.DisplayToast("TEST", x.ReadString(0));
}
}

RE: what doesn't work? by markee on 08-27-2006 at 11:49 AM

quote:
Originally posted by kris2000
Thank you, but it doesn't work

code:
var x;

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin,Message,MessageKind)
{
if (Message == "test1") {
x.WriteString(0, "test");
}
if (Message == "test2") {
MsgPlus.DisplayToast("TEST", x.ReadString(0));
}
}

This is because this method is not supported by JScript as far as I can see.  I will work if you do it like the first example given by Ash_
RE: what doesn't work? by Matti on 08-27-2006 at 11:57 AM

WriteString() and ReadString() are childfunctions of the Databloc object. I think you misunderstood the Plus! Live documentation, since using a DataBloc to save strings is really unneeded. DataBlocs are almost only used to call Windows API functions requiring a memory bloc pointer, like the Color Picker dialog.

The best thing you can do is using Ash_'s function, which is 100% correct. ;)