What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Whats wrong with this?

Pages: (3): « First « 1 [ 2 ] 3 » Last »
Whats wrong with this?
Author: Message:
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Whats wrong with this?
it returns undefined because you never set "rndnumber" if the Msg is !an.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
07-22-2006 10:43 PM
Profile PM Web Find Quote Report
Hengy
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: Whats wrong with this?
I don't really get what your trying to tell me... srry
07-22-2006 10:50 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Whats wrong with this?
if(Msg == "!an") {
     return rndnumber + "was the correct number.";
}


you don't set rndnumber anywhere there.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
07-22-2006 10:51 PM
Profile PM Web Find Quote Report
Hengy
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: Whats wrong with this?
Srry, I didn't know what u meant :-s
It works now though, Thanks
07-22-2006 10:53 PM
Profile PM Find Quote Report
cloudhunter
Senior Member
****


Posts: 536
Reputation: 18
37 / – / –
Joined: Dec 2005
RE: Whats wrong with this?
Can't see how... But hey, your script. It is a bit sloppy coding though...

Cloudy
[Image: cloudy.jpg]
Sig by pirateok/marisaok/marisa ;)
quote:
Originally posted by Moulin Rouge
The greatest thing you'll ever learn, is just to love and be loved in return

6910 days, 13 hours, 46 minutes, 7 seconds ago
07-23-2006 12:10 AM
Profile E-Mail PM Find Quote Report
Hengy
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. Huh?  RE: Whats wrong with this?
(yes, it's me again... 8-|)
so i've got this:

code:
var rndnumber = Math.floor(Math.random()*26);

function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
    if(Msg == "!pick")
        {
        return "Pick a number between 0 and 25";
        }
if(Msg == rndnumber)
        {
        return Command_Win();
        }

function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Msg,MsgKind)
{
    if(Msg == rndnumber)
        {
        return Command_Win();
        }
    }
}

function Command_Win()
{
return rndnumber + " was the correct number! ";
}

But the random number is only generated once, and if you try this script again without modifying the script (exiting the conv doesn't work) then the random number is still the same... Is there anyway to get around this?
07-23-2006 01:24 AM
Profile PM Find Quote Report
mickael9
Full Member
***


Posts: 117
Reputation: 3
33 / Male / Flag
Joined: Jul 2005
RE: RE: Whats wrong with this?
quote:
Originally posted by Hengy
(yes, it's me again... 8-|)
so i've got this:

code:
var rndnumber = Math.floor(Math.random()*26);

function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
    if(Msg == "!pick")
        {
        return "Pick a number between 0 and 25";
        }
if(Msg == rndnumber)
        {
        return Command_Win();
        }

function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Msg,MsgKind)
{
    if(Msg == rndnumber)
        {
        return Command_Win();
        }
    }
}

function Command_Win()
{
return rndnumber + " was the correct number! ";
}

But the random number is only generated once, and if you try this script again without modifying the script (exiting the conv doesn't work) then the random number is still the same... Is there anyway to get around this?


code:
var rndnumber;

function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
    if(Msg == "!pick")
    {
        rndnumber = Math.floor(Math.random()*26);
        return "Pick a number between 0 and 25";
    }
    if(Msg == rndnumber)
    {
        return Command_Win();
    }
   
    function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Msg,MsgKind)
    {
        if(Msg == rndnumber)
        {
            return Command_Win();
        }
    }
}

function Command_Win()
{
    rndnumber = null;
    return rndnumber + " was the correct number! ";
}
:D

This post was edited on 07-23-2006 at 01:49 AM by mickael9.
07-23-2006 01:45 AM
Profile PM Web Find Quote Report
cloudhunter
Senior Member
****


Posts: 536
Reputation: 18
37 / – / –
Joined: Dec 2005
RE: Whats wrong with this?
Simple :)

code:
var rndnumber;
function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
if(Msg == "!pick")
{
rndnumber = Math.floor(Math.random()*26);
return "Pick a number between 0 and 25";
}
}


function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Message,MsgKind)
{
if(Message == rndnumber)
{
Command_Win(Wnd);
}
}

function Command_Win(Wnd)
{
Wnd.SendMessage(rndnumber + " was the correct number! ");
}

This code is fully working, when you send !pick it tells you AND the contact "Pick a number between 0 and 25". When you or the contact get the number right it now says you have won :) It generates the random number each time you say !pick.

Cloudy

Edit: Beaten to it, but my alteration works correctly ;) It now picks wins from both the contact and the sender, as you don't need both send and recieve for that as any messages you send count as recieved messages aswell. It also now returns the win to the conversation window properly once someone gets it right. Before what it would have done was alter the recieved message on your end.

This post was edited on 07-23-2006 at 02:00 AM by cloudhunter.
[Image: cloudy.jpg]
Sig by pirateok/marisaok/marisa ;)
quote:
Originally posted by Moulin Rouge
The greatest thing you'll ever learn, is just to love and be loved in return

6910 days, 13 hours, 46 minutes, 7 seconds ago
07-23-2006 01:54 AM
Profile E-Mail PM Find Quote Report
Hengy
Junior Member
**


Posts: 16
Joined: Jul 2006
O.P. RE: Whats wrong with this?
WOW! Thanks alot! :D
07-23-2006 02:16 PM
Profile PM Find Quote Report
mickael9
Full Member
***


Posts: 117
Reputation: 3
33 / Male / Flag
Joined: Jul 2005
RE: RE: Whats wrong with this?
quote:
Originally posted by cloudhunter
Simple :)

code:
var rndnumber;
function OnEvent_ChatWndSendMessage(Wnd,Msg)
{
if(Msg == "!pick")
{
rndnumber = Math.floor(Math.random()*26);
return "Pick a number between 0 and 25";
}
}


function OnEvent_ChatWndReceiveMessage(Wnd,Sender,Message,MsgKind)
{
if(Message == rndnumber)
{
Command_Win(Wnd);
}
}

function Command_Win(Wnd)
{
Wnd.SendMessage(rndnumber + " was the correct number! ");
}

This code is fully working, when you send !pick it tells you AND the contact "Pick a number between 0 and 25". When you or the contact get the number right it now says you have won :) It generates the random number each time you say !pick.

Cloudy

Edit: Beaten to it, but my alteration works correctly ;) It now picks wins from both the contact and the sender, as you don't need both send and recieve for that as any messages you send count as recieved messages aswell. It also now returns the win to the conversation window properly once someone gets it right. Before what it would have done was alter the recieved message on your end.


try to say the number twice :P

This post was edited on 07-23-2006 at 06:05 PM by mickael9.
07-23-2006 06:02 PM
Profile PM Web Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On