What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Random Line Away messages

Pages: (2): « First [ 1 ] 2 » Last »
Random Line Away messages
Author: Message:
Aztek
New Member
*


Posts: 5
37 / Male / Flag
Joined: Jun 2008
O.P. Random Line Away messages
Hello

I would like an script that can take lines of strings and send them randomly every 10 seconds if i am away and receive a message but only send the message once every 10 seconds and only if the contact has sent a message

example:

contact: hi
me: Automessage: randomline
10+ seconds later
contact: hi
me: Automessage: randomline2
less than 10 seconds later
contact: hi
... (nothingness)
10+ seconds later
contact: hi
me: Automessage: randomline3

This post was edited on 06-29-2008 at 02:48 AM by Aztek.
06-29-2008 02:40 AM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Random Line Away messages
Hello Aztek,

I understand that you want the script to send a random message, ten seconds after a contact has sent a message to you (please correct me if I'm wrong)?
06-29-2008 04:44 PM
Profile PM Find Quote Report
Aztek
New Member
*


Posts: 5
37 / Male / Flag
Joined: Jun 2008
O.P. RE: Random Line Away messages
no the message is sent instantly after reciving a message but if the contact says something within 10 seconds nothing is sent but if he/she waits for over 10 seconds to send the next message another random message is sent
06-29-2008 05:12 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Random Line Away messages
Okay..

I have an idea that _should_ work (can't guarantee though):

code:
var RandomMessages = new Array("Message 0","Message 2",...,"Message9"); // no further than 9
OnEvent_ChatWndReceiveMessage(pChatWnd,mOrigin,sMessage,kMsgKind) {
      cWnd = pChatWnd;
      if(!TimerStarted) {
            if(mOrigin != Messenger.MyName) {
                  TimerStarted = true;
                  MsgPlus.AddTimer("TmrMsg",10000);
            }
      } else {
            MsgPlus.CancelTimer("TmrMsg");
            TimerStarted = false;
      }
      return sMessage;
}

function OnEvent_Timer(sTimerId) {
      if(sTimerId == "TmrMsg") {
            if(TimerStarted) {
                  cWnd.SendMessage(RandomMessage());
                  MsgPlus.AddTimer("TmrMsg",10000);
            }
      }
}

function RandomMessage() {
      Index = Math.random().charAt(4);
      return RandomMessages[Index];
}


EDIT::

Maybe you should prefix the messages with "AutoMessage: ", since this uses Plus!'s AutoMessage feature (when a personalised status is used)..

This post was edited on 06-29-2008 at 05:31 PM by SmokingCookie.
06-29-2008 05:29 PM
Profile PM Find Quote Report
Aztek
New Member
*


Posts: 5
37 / Male / Flag
Joined: Jun 2008
O.P. RE: Random Line Away messages
how could i put more than 9 ??
06-29-2008 05:31 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Random Line Away messages
Uhm.. Please let me think for another 10 seconds....

EDIT::

Change the last function to:[

code:

var Index = new Array();

function RandomMessage() {
      Index[0] = Math.random().charAt(4); // could be any number between 2 and 18
      Index[1] = Math.random().charAt(7); //  // could be any number between 2 and 18
      Index[2] = Math.random().substr(Index[0],Index[1]); // Please note!! You need 99 messages, or the chat will send "undefined";
      return RandomMessages[Index[2]];
}



This post was edited on 06-29-2008 at 05:39 PM by SmokingCookie.
06-29-2008 05:33 PM
Profile PM Find Quote Report
Aztek
New Member
*


Posts: 5
37 / Male / Flag
Joined: Jun 2008
O.P. RE: Random Line Away messages
nice but could you send the entire script ?

im having problems assembling this thingy :P

as i said, im VERY bad at jscript (or well i did on irc)

edit: oh and i have 460 messages to put into the script :P

This post was edited on 06-29-2008 at 05:45 PM by Aztek.
06-29-2008 05:42 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: Random Line Away messages
I'm sorry, I no longer have time now, have to go.
I'll give it another try tomorrow..
06-29-2008 06:03 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Random Line Away messages
quote:
Originally posted by SmokingCookie
Uhm.. Please let me think for another 10 seconds....

EDIT::

Change the last function to:
code:
var Index = new Array();

function RandomMessage() {
      Index[0] = Math.random().charAt(4); // could be any number between 2 and 18
      Index[1] = Math.random().charAt(7); //  // could be any number between 2 and 18
      Index[2] = Math.random().substr(Index[0],Index[1]); // Please note!! You need 99 messages, or the chat will send "undefined";
      return RandomMessages[Index[2]];
}



ermmm... that is the most "original" method I've seen to get a random number between x and y...

The proper way would be to multiply the random number (which is always a decimal number between 0 and 1) with a certain upper bound number to enlarge it, and maybe add another lower bound number to start the random number from...

Math.floor((upperbound - lowerbound + 1) * Math.random() + lowerbound);

see "CookieRevised's reply to [Request] Random Number Generator"...

And you might also check "CookieRevised's reply to Random numbers, prevent from being used more than once" for a snippet very related to this random message sending stuff...

Anyways, the script you've posted so far doesn't work at all like Aztek wanted.

Sorry to be so negative though... :(:$ But way cool that you at least tried to help.

Anyways, Aztek, did you already checked the official scripting Database? I wouldn't be surprised if the script you ask for already exists...

This post was edited on 06-29-2008 at 11:15 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-29-2008 11:12 PM
Profile PM Find Quote Report
Aztek
New Member
*


Posts: 5
37 / Male / Flag
Joined: Jun 2008
O.P. RE: Random Line Away messages
CookieRevised, could you fix it ?
06-29-2008 11:16 PM
Profile PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » 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