Reply to any message |
Author: |
Message: |
SourSpud
Junior Member
spud, spud, spud, spoon.
Posts: 58
35 / /
Joined: Nov 2009
|
O.P. Reply to any message
I would like to reply to any message sent, for instance someone opens a conversation with me and types 'hey, staturday was fun.' I will reply with 'hai' but as soon as ive replied with hai i don't want to reply with 'hai' again after the next message is received so it doesn't loop.
thanks alot
This post was edited on 12-03-2009 at 06:00 AM by SourSpud.
|
|
12-03-2009 05:59 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Reply to any message
You can't really detect who sent the first message.
Well I guess you could compare the Handle from the ChatWnd parameter in OnEvent_ChatWndCreated to the Handle of the ChatWnd parameter in OnEvent_ChatWndReceiveMessage that could work.
This post was edited on 12-03-2009 at 12:49 PM by matty.
|
|
12-03-2009 12:47 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Reply to any message
quote: Originally posted by matty
You can't really detect who sent the first message.
Although if you script it right, it'll send "Hai" before your first message to them anyway. So you'll always say "hai" then your message, or the send something and then you send "hai" after it.
<Eljay> "Problems encountered: shit blew up"
|
|
12-03-2009 12:51 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Reply to any message
The problem is he wants it to reply to the first message they send ONLY if the window wasn't open before.
js code: // Create an object container to store the chat window object
var oChatWnds = {};
// Store the chat window object in our object container when it is opened
function OnEvent_ChatWndCreated(oChatWnd) {
oChatWnds[oChatWnd.Handle] = {};
}
// Remove the variable from the object if the window is closed
function OnEvent_ChatWndDestroyed(oChatWnd) {
delete oChatWnds[oChatWnd.Handle];
}
// If we send a message remove the chat window from the object container
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
delete oChatWnds[oChatWnd.Handle];
}
// If we receive a message and the chat window exists in the object container
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageKind) {
if (typeof oChatWnds[oChatWnd.Handle] === 'object') {
// Send the message
oChatWnd.SendMessage('hai');
// Remove the chat window from the object container
delete oChatWnds[oChatWnd.Handle];
}
}
Untested code but give it a shot.
This post was edited on 12-03-2009 at 02:09 PM by matty.
|
|
12-03-2009 02:09 PM |
|
|
SourSpud
Junior Member
spud, spud, spud, spoon.
Posts: 58
35 / /
Joined: Nov 2009
|
O.P. RE: Reply to any message
tested seems to be working well thanks alot matty. Should have mentioned this earlyer, can it do a ranomise message say hi, hai, hello, hey. it will pick one of those.
Cheers
This post was edited on 12-03-2009 at 07:56 PM by SourSpud.
|
|
12-03-2009 07:31 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Reply to any message
Add this to the start of the script
js code: var messages = new Array("Hi", "Hai", "Hello", "Hey");
and change this line:
js code: oChatWnd.SendMessage('hai');
to this:
js code: oChatWnd.SendMessage(messages[Math.floor(Math.random()*(messages.length+1)])
Haven't tested, but that should work
This post was edited on 12-03-2009 at 09:36 PM by Spunky.
<Eljay> "Problems encountered: shit blew up"
|
|
12-03-2009 08:36 PM |
|
|
SourSpud
Junior Member
spud, spud, spud, spoon.
Posts: 58
35 / /
Joined: Nov 2009
|
O.P. RE: Reply to any message
thanks for reply, i'm gettin this error
jscript code: oChatWnd.SendMessage(message[Math.floor(Math.random()*(messages.length+1)])
quote: Error: Expected ')' (code: -2146827282)
This post was edited on 12-03-2009 at 09:29 PM by SourSpud.
|
|
12-03-2009 09:05 PM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: Reply to any message
Change
jscript code: oChatWnd.SendMessage(message[Math.floor(Math.random()*(messages.length+1)])
to
jscript code: oChatWnd.SendMessage(message[Math.floor(Math.random()*(messages.length+1))])
(note the extra right paren)
This post was edited on 12-03-2009 at 09:27 PM by Mnjul.
|
|
12-03-2009 09:26 PM |
|
|
SourSpud
Junior Member
spud, spud, spud, spoon.
Posts: 58
35 / /
Joined: Nov 2009
|
O.P. RE: Reply to any message
thanks it works now my messages are in colour though. for example [c=49]Hai[/c] is there a way of the script checking if the person has Plus! installed before sending the message, and if its not installed don't send it.
|
|
12-03-2009 09:33 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Reply to any message
Not really. The only way you can tell is by sending /ping... If you get a response they definitely have MP!L. If not they either don't have it, or have disabled the ping response.
It's too much hassle just to add to this, but you could add a "safe senders list" by manually adding contact's email addresses that can receive colours, but as I said, you'd have to ping each one...
<Eljay> "Problems encountered: shit blew up"
|
|
12-03-2009 09:36 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|