mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2007
Posts: 40
Q
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?

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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
Joined: Jun 2007
Posts: 40
Q
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.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
I edited the code. It should work now smile


I am SReject
My Stuff
Joined: Jul 2007
Posts: 1,129
T
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.
Joined: Sep 2005
Posts: 2,881
H
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$/)

Joined: Jul 2007
Posts: 1,129
T
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.
Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
Hixxy's post is quite clear, \E isn't the same as \e in regex, $replace could return an invalid string


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 1,129
T
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.

Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
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.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2007
Posts: 40
Q
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?

Joined: Jul 2007
Posts: 1,129
T
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?

Joined: Jun 2007
Posts: 40
Q
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?

Joined: Jul 2007
Posts: 1,129
T
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

Joined: Aug 2004
Posts: 7,252
R
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.


Joined: Jun 2007
Posts: 40
Q
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
So how do i change it to pink?

Joined: Jun 2007
Posts: 40
Q
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2007
Posts: 40
bump

Joined: Oct 2004
Posts: 8,330
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

Link Copied to Clipboard