mIRC Homepage
Posted By: Question What if i want a message to play - 05/03/11 05:52 AM
What script would i use if i wanted a message to play everytime i got slapped?
Posted By: FroggieDaFrog Re: What if i want a message to play - 05/03/11 06:15 AM
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
Posted By: Question Re: What if i want a message to play - 05/03/11 10:04 AM
Hmm, thanks, but it doesnt seem to work. I put it in the remotes tab in script editor.
Posted By: FroggieDaFrog Re: What if i want a message to play - 05/03/11 10:32 AM
I edited the code. It should work now smile
Posted By: Tomao Re: What if i want a message to play - 05/03/11 10:39 AM
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.
Posted By: hixxy Re: What if i want a message to play - 05/03/11 01:02 PM
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$/)
Posted By: Tomao Re: What if i want a message to play - 05/03/11 08:58 PM
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?
Posted By: Wims Re: What if i want a message to play - 05/03/11 09:04 PM
Hixxy's post is quite clear, \E isn't the same as \e in regex, $replace could return an invalid string
Posted By: Tomao Re: What if i want a message to play - 05/03/11 11:00 PM
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.
Posted By: Wims Re: What if i want a message to play - 05/03/11 11:52 PM
Ah sorry, then it's because \E could be in $me, which would be problematic for the regex pattern
Posted By: Question Re: What if i want a message to play - 06/03/11 01:44 AM
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?
Posted By: Tomao Re: What if i want a message to play - 06/03/11 03:23 AM
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?
Posted By: Question Re: What if i want a message to play - 20/03/11 07:26 AM
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?
Posted By: Tomao Re: What if i want a message to play - 20/03/11 08:19 AM
Nice going dude...it takes you like two weeks to figure this out. lol
Posted By: RusselB Re: What if i want a message to play - 20/03/11 03:58 PM
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.

Posted By: Question Re: What if i want a message to play - 26/03/11 01:16 AM
So how do i change it to pink?
Posted By: Question Re: What if i want a message to play - 29/03/11 06:11 PM
bump
Posted By: Riamus2 Re: What if i want a message to play - 29/03/11 06:40 PM
The same way you would type a message in a color. Put Ctrl-K and the color number into the message.
© mIRC Discussion Forums