mIRC Home    About    Download    Register    News    Help

Print Thread
What if i want a message to play #230349 05/03/11 05:52 AM
Joined: Jun 2007
Posts: 40
Q
Question Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
What script would i use if i wanted a message to play everytime i got slapped?

Re: What if i want a message to play [Re: Question] #230350 05/03/11 06:15 AM
Joined: Apr 2010
Posts: 957
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 957
Sorry about that, had something extra that wasn't needed
Code:
on *:ACTION:*:#:{
  var %m = /\bslaps\b.*\b\Q $+ $replace($me,\E,\E\\E\Q) $+ \E\b/iS
  if ($regex($1-,%m)) {
    msg $chan DON'T SLAP ME!
  }
}


;Edited to fix code

Last edited by FroggieDaFrog; 05/03/11 10:32 AM.

I am SReject
My Stuff
Re: What if i want a message to play [Re: FroggieDaFrog] #230351 05/03/11 10:04 AM
Joined: Jun 2007
Posts: 40
Q
Question Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
Hmm, thanks, but it doesnt seem to work. I put it in the remotes tab in script editor.

Re: What if i want a message to play [Re: Question] #230352 05/03/11 10:32 AM
Joined: Apr 2010
Posts: 957
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 957
I edited the code. It should work now smile


I am SReject
My Stuff
Re: What if i want a message to play [Re: FroggieDaFrog] #230353 05/03/11 10:39 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Froggie, why not use the on action regex instead:
Code:
on $*:ACTION:$(/\bslaps\b.*\b\Q $+ $replace($me,\E,\E\\E\Q) $+ \E\b/iS):#:{
  msg $chan DON'T SLAP ME!
}
You save yourself an if statement and a local variable. A trigger flood control may be put into consideration so the client that runs the code doesn't get scrolled.

Last edited by Tomao; 05/03/11 10:47 AM.
Re: What if i want a message to play [Re: FroggieDaFrog] #230355 05/03/11 01:02 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
A small criticism: You should use $replacecs() instead of $replace(), as the \Q...\E sequence is case-sensitive. An \e would not end the escape sequence, as you can see here:

Code:
//echo -a $regex(\e,/^\Q\e\E$/)

Re: What if i want a message to play [Re: Tomao] #230369 05/03/11 08:58 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Can anyone be so kind to explain to me why the $replacecs() is or has to be used? In other words, what's the main role it plays?

Last edited by Tomao; 05/03/11 09:02 PM.
Re: What if i want a message to play [Re: Tomao] #230370 05/03/11 09:04 PM
Joined: Jul 2006
Posts: 3,723
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,723
Hixxy's post is quite clear, \E isn't the same as \e in regex, $replace could return an invalid string


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: What if i want a message to play [Re: Wims] #230372 05/03/11 11:00 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: Wims
Hixxy's post is quite clear, \E isn't the same as \e in regex, $replace could return an invalid string
I think I worded my say in a confusing manner. I was asking for an explanation of why the the identifier $replace should be utilized in the regex pattern. Again, I'm not asking for an answer to the difference between $replace() and $replacecs(); I'm asking about the necessity behind it.

Re: What if i want a message to play [Re: Tomao] #230376 05/03/11 11:52 PM
Joined: Jul 2006
Posts: 3,723
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,723
Ah sorry, then it's because \E could be in $me, which would be problematic for the regex pattern

Last edited by Wims; 05/03/11 11:54 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: What if i want a message to play [Re: Wims] #230377 06/03/11 01:44 AM
Joined: Jun 2007
Posts: 40
Q
Question Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
Hmm neither seems to work.

on $*:ACTION:$(/\bslaps\b.*\b\Q $+ $replace($me,\E,\E\\E\Q) $+ \E\b/iS):#:{
msg $chan UNINSTALLRO, UNINSTALLRO~ UNI UNINSTALLRO, UNI UNINSTALLRO ~♪
}

I put that in my remotes tab and nothing happens when i get slapped.

Also, how do i change the color of the text that appears?

Re: What if i want a message to play [Re: Question] #230378 06/03/11 03:23 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
The code is working fine for me:
Code:
on $*:action:$(/\bslaps\b.*\b\Q $+ $replacecs($me,\E,\E\\E\Q) $+ \E\b/iS):#:{
  msg # UNINSTALLRO, UNINSTALLRO~ UNI UNINSTALLRO, UNI UNINSTALLRO ~♪
}
I'm not certain why it fails on you. The only thing I can think of is to make sure your remote is on by entering: /remote on

What color of text do you want it to appear?

Re: What if i want a message to play [Re: Tomao] #230771 20/03/11 07:26 AM
Joined: Jun 2007
Posts: 40
Q
Question Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
Oh, i figured it out, i was trying to slap myself but the message wasnt triggering. It seems to only trigger if someone else slaps me.

I was thinking pink?

Re: What if i want a message to play [Re: Question] #230772 20/03/11 08:19 AM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Nice going dude...it takes you like two weeks to figure this out. lol

Re: What if i want a message to play [Re: Question] #230790 20/03/11 03:58 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
From the help file under ON TEXT
Quote:
Note: You cannot test out these events by typing text to yourself. They can only be initiated by someone else saying something in a channel or in a private message.


Re: What if i want a message to play [Re: RusselB] #230941 26/03/11 01:16 AM
Joined: Jun 2007
Posts: 40
Q
Question Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
So how do i change it to pink?

Re: What if i want a message to play [Re: Question] #231033 29/03/11 06:11 PM
Joined: Jun 2007
Posts: 40
Q
Question Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
bump

Re: What if i want a message to play [Re: Question] #231036 29/03/11 06:40 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The same way you would type a message in a color. Put Ctrl-K and the color number into the message.


Invision Support
#Invision on irc.irchighway.net