mIRC Home    About    Download    Register    News    Help

Topic Options
#230349 - 05/03/11 05:52 AM What if i want a message to play
Question Offline
Ameglian cow

Registered: 24/06/07
Posts: 40
What script would i use if i wanted a message to play everytime i got slapped?

Top
#230350 - 05/03/11 06:15 AM Re: What if i want a message to play [Re: Question]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 905
Loc: USA
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


Edited by FroggieDaFrog (05/03/11 10:32 AM)
_________________________
I am SReject
My Stuff

Top
#230351 - 05/03/11 10:04 AM Re: What if i want a message to play [Re: FroggieDaFrog]
Question Offline
Ameglian cow

Registered: 24/06/07
Posts: 40
Hmm, thanks, but it doesnt seem to work. I put it in the remotes tab in script editor.

Top
#230352 - 05/03/11 10:32 AM Re: What if i want a message to play [Re: Question]
FroggieDaFrog Online
Hoopy frood

Registered: 16/04/10
Posts: 905
Loc: USA
I edited the code. It should work now smile
_________________________
I am SReject
My Stuff

Top
#230353 - 05/03/11 10:39 AM Re: What if i want a message to play [Re: FroggieDaFrog]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.


Edited by Tomao (05/03/11 10:47 AM)

Top
#230355 - 05/03/11 01:02 PM Re: What if i want a message to play [Re: FroggieDaFrog]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2875
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$/)

Top
#230369 - 05/03/11 08:58 PM Re: What if i want a message to play [Re: Tomao]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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?


Edited by Tomao (05/03/11 09:02 PM)

Top
#230370 - 05/03/11 09:04 PM Re: What if i want a message to play [Re: Tomao]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3435
Loc: France
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

Top
#230372 - 05/03/11 11:00 PM Re: What if i want a message to play [Re: Wims]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.

Top
#230376 - 05/03/11 11:52 PM Re: What if i want a message to play [Re: Tomao]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3435
Loc: France
Ah sorry, then it's because \E could be in $me, which would be problematic for the regex pattern


Edited by Wims (05/03/11 11:54 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#230377 - 06/03/11 01:44 AM Re: What if i want a message to play [Re: Wims]
Question Offline
Ameglian cow

Registered: 24/06/07
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?

Top
#230378 - 06/03/11 03:23 AM Re: What if i want a message to play [Re: Question]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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?

Top
#230771 - 20/03/11 07:26 AM Re: What if i want a message to play [Re: Tomao]
Question Offline
Ameglian cow

Registered: 24/06/07
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?

Top
#230772 - 20/03/11 08:19 AM Re: What if i want a message to play [Re: Question]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
Nice going dude...it takes you like two weeks to figure this out. lol

Top
#230790 - 20/03/11 03:58 PM Re: What if i want a message to play [Re: Question]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.


Top
#230941 - 26/03/11 01:16 AM Re: What if i want a message to play [Re: RusselB]
Question Offline
Ameglian cow

Registered: 24/06/07
Posts: 40
So how do i change it to pink?

Top
#231033 - 29/03/11 07:11 PM Re: What if i want a message to play [Re: Question]
Question Offline
Ameglian cow

Registered: 24/06/07
Posts: 40
bump

Top
#231036 - 29/03/11 07:40 PM Re: What if i want a message to play [Re: Question]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top