What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Little help with a code??? -> ANOTHER HELP

Little help with a code??? -> ANOTHER HELP
Author: Message:
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
36 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. Huh?  Little help with a code??? -> ANOTHER HELP
Hello people,

Me and my "very good, excelent and briliant skills" on coding :$ tryed to do a very-simple timed status changer, BUT, of course, Plus! didn't accept it (the code it's wrong).
code:
function OnEvent_Initialize(MessengerStart)
{
MsgPlus.AddTimer("Statuz", 300000);
}

function onEvent_Timer(timerID)
{

if(timerID == "Statuz")
{
Messenger::MyStatus = 2
}


Can someone try to teach where are the errors, please???
:S:$

Edit: Forgot to say that I tryed to find answers by using the search function, but nothing... :S

This post was edited on 03-19-2007 at 10:34 PM by MicroWay.
03-19-2007 02:29 AM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Little help with a code???
This should work:

code:
function OnEvent_Initialize(MessengerStart)
{
MsgPlus.AddTimer("Statuz", 300000);
}

function OnEvent_Timer(timerID)
{

if(timerID == "Statuz")
{
Messenger.MyStatus = 2;
}
}

EDIT: Fixed something I didn't notice before :P

This post was edited on 03-19-2007 at 02:39 AM by deAd.
03-19-2007 02:32 AM
Profile PM Find Quote Report
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
36 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. RE: Little help with a code???
Cool!!! Thanks!!!
I was caught by an "::" and a missing "}" :$

I'll try to improve it... If I had any other problems, I'll post it here...
;)

This post was edited on 03-19-2007 at 10:37 PM by MicroWay.
03-19-2007 02:48 AM
Profile PM Find Quote Report
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
36 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. RE: Little help with a code??? -> ANOTHER HELP
Hello... I have another problem :$
I updated it, but the comand isn't being recognized...
Please, take a look (the same question as before)
code:
function OnGetScriptCommands(){
    var ScriptCommands = "<ScriptCommands>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>sleep</Name>";
    ScriptCommands    +=         "<Description>Tempo para a contagem</Description>";
    ScriptCommands    +=           "<Parameters>&lt;Tempo em minutos&gt;</Parameters>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    += "</ScriptCommands>";

    return ScriptCommands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message.substr(0, 7) == "/sleep "){
        var tyme = Message.substr(Message.search(' ')*60000);
        sleeptime();
        return "";
        }

function sleeptime()
{
MsgPlus.AddTimer("Statuz", tyme);
MsgPlus.DisplayToast("Status Changer", "Timer iniciado: "+tyme+" milisegundos para Offline");
}

function OnEvent_Timer(timerID)
{
if(timerID == "Statuz")
{
Messenger.MyStatus = 2;
}
}
  }

03-19-2007 10:37 PM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: RE: Little help with a code??? -> ANOTHER HELP
code:
function OnGetScriptCommands(){
    var ScriptCommands = "<ScriptCommands>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>sleep</Name>";
    ScriptCommands    +=         "<Description>Tempo para a contagem</Description>";
    ScriptCommands    +=           "<Parameters>&lt;Tempo em minutos&gt;</Parameters>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    += "</ScriptCommands>";

    return ScriptCommands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message.substr(0, 7) == "/sleep "){
        var tyme = Message.substr(Message.search(' ')*60000);
        sleeptime();
        return "";
        }
}

function sleeptime()
{
MsgPlus.AddTimer("Statuz", tyme);
MsgPlus.DisplayToast("Status Changer", "Timer iniciado: "+tyme+" milisegundos para Offline");
}

function OnEvent_Timer(timerID)
{
if(timerID == "Statuz")
{
Messenger.MyStatus = 2;
}
}

You just added a bracket to the end where it should have been earlier ;)
[Image: markee.png]
03-19-2007 10:41 PM
Profile PM Find Quote Report
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
36 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. RE: Little help with a code??? -> ANOTHER HELP
Thanks for that...  :$
But now on the Debbuging, it has an error on Line 23 ("tyme" isn't defined... The function OnEvent_ChatWndSendMessage results in an error)...

Maybe the multiplication by 60000 it's wong???


here is the line 23:
MsgPlus.AddTimer("Statuz", tyme);

EDIT:
Forgot to say that I wanted to make the script start working when "/sleep <number>" is typed. This number should be in minutes. So, with the time selected, it'll change the status to AppearOfline

This post was edited on 03-19-2007 at 10:55 PM by MicroWay.
03-19-2007 10:45 PM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: Little help with a code??? -> ANOTHER HELP
That is because you are storing tyme as a local variable rather than a global one and you are not parsing it to the other function.  Try this code instead....

code:
function OnGetScriptCommands(){
var ScriptCommands = "<ScriptCommands>";
ScriptCommands    +=     "<Command>";
ScriptCommands    +=         "<Name>sleep</Name>";
ScriptCommands    +=         "<Description>Tempo para a contagem</Description>";
ScriptCommands    +=   "<Parameters>&lt;Tempo em minutos&gt;</Parameters>";
ScriptCommands    +=     "</Command>";
ScriptCommands    += "</ScriptCommands>";

return ScriptCommands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
if (Message.substr(0, 7) == "/sleep "){
var tyme = Message.substr(Message.search(' ')*60000);
sleeptime(tyme);
return "";
}
}

function sleeptime(tyme)
{
MsgPlus.AddTimer("Statuz", tyme);
MsgPlus.DisplayToast("Status Changer", "Timer iniciado: "+tyme+" milisegundos para Offline");
}

function OnEvent_Timer(timerID)
{
if(timerID == "Statuz")
{
Messenger.MyStatus = 2;
}
}
[Image: markee.png]
03-19-2007 11:09 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
RE: Little help with a code??? -> ANOTHER HELP
FIXED
quote:
Originally posted by markee


   function OnGetScriptCommands(){
    var ScriptCommands = "<ScriptCommands>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>sleep</Name>";
    ScriptCommands    +=         "<Description>Tempo para a contagem</Description>";
    ScriptCommands    +=   "<Parameters>&lt;Tempo em minutos&gt;</Parameters>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    += "</ScriptCommands>";

    return ScriptCommands;
    }

    function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message.substr(0, 7) == "/sleep "){
    var tyme = Message.substr(Message.search(' '))*60000;//------>PAY  ATTENTION HERE
    sleeptime(tyme);
    return "";
    }
    }

    function sleeptime(tyme)
    {
    MsgPlus.AddTimer("Statuz", tyme);
    MsgPlus.DisplayToast("Status Changer", "Timer iniciado: "+tyme+" milisegundos para Offline");
    }

    function OnEvent_Timer(timerID)
    {
    if(timerID == "Statuz")
    {
    Messenger.MyStatus = 2;
    }
    }

This post was edited on 03-19-2007 at 11:37 PM by TheGuruSupremacy.
03-19-2007 11:34 PM
Profile PM Find Quote Report
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
36 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. RE: Little help with a code??? -> ANOTHER HELP
Thanks all people for helping me!!! ;)
It's working now!!!!
(Y)
03-20-2007 12:17 AM
Profile PM Find Quote Report
« 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