CHANGE #CHAN TO YOUR CHANNEL, USE FOR A BOT
Im new to scripting, and i was asking a friend on "text" things. And i came up with a On text "LOL"
You can use this on many other things, Change "Lol" to a text, and the 2nd line is a command (note you want to keep $+} from my testings.
Give credit to lordgruntie on mIRC if you see him.
You might need to put this on a bot
Suggestions?
on *:TEXT:Lol:#chan:{
msg #chan $nick We are all laughing at you! not with you! I mean.. With you.. -AhemAhem- $+ }
;You can take out $Nick if you want. You can change the text. keep $+. Change the #Chan to the channel,You
;Can change the text. You can change "msg #chan" to "/kick #chan, /ban #chan, etc"
extremity, unfortunately since /inc -uN doesn't decrease after N seconds but rather (re)initializes a timer that unsets it after those N seconds, that bit of code doesn't check precisely for "3 commands in 2 seconds". %lol.flood will equal 4 if those 4 increments are made within just under 2 seconds of each other, ie. 4 increments in just under 6 seconds in the worst case. for more info and a solution to this problem check out this post
Flood control can be done several ways.. basically you halt the alias if the command has been used too many times within too many seconds..
my code is basic and I am certain that others have much more effective code that handles per channel and is shorter.
Basic Example:
;allows 3 commands per every 2 seconds, change numbers as you wish
on *:TEXT:Lol:#:{
;increments (adds +1) a flood variable that resets after 2 seconds
inc -u2 %lol.flood
;if the flood variable has not incremented 3 or more
if (%lol.flood <= 3) {
msg # $nick We are all laughing at you! not with you! I mean.. With you.. -AhemAhem-
}
}
regex seems to be a way of life around here .. slow or not in msl (Y)
mIRC uses the PCRE library when matching a regular expression against a string, so most of the time it only needs to perform basic operations whenever regex is involved. the only function where it may be considered suitable to discuss the efficiency of mIRC's implementation, since it performs a significant amount of additional work, is $regsubex() and yes, it is a lot slower than it needs to be. mIRC goes through a rather convoluted process when replacements are made with $regsubex() so you can say that, where it counts, mIRC's implementation of regex is slow.
I was wondering why we needed the $+ in this... Which we really don't. Yes I know what it is like with the Bracket marking... I had a couple problems with a script and I set forth to figure it out myself. Come to figure out I was missing an Identifier split the Colon ( : ) and I was missing an End Bracket. I tell ya Strive to learn the next thing if you are really looking to get into this. I should look into regex next myself.
you say leave the $+ } in there why?
you could take it out an do
on *:TEXT:Lol:#:{
msg # $nick We are all laughing at you! not with you! I mean.. With you.. -AhemAhem-
}
or even
on *:TEXT:Lol:#:msg # $nick We are all laughing at you! not with you! I mean.. With you.. -AhemAhem-
also you may want to make it so people that use color can trigger it by stripping out the color either by doing..
on $*:text:/^lol$/iS:#:msg # $nick We are all laughing at you! not with you! I mean.. With you.. -AhemAhem-
or
on *:text:$($iif(lol == $strip($1),$1)):#:msg # $nick We are all laughing at you! not with you! I mean.. With you.. -AhemAhem-
an maybe add some sort of flood control so people can't flood you out.
an so on....
anyways keep at it we all have to start somewhere....