|
Joined: Nov 2021
Posts: 141
Vogon poet
|
OP
Vogon poet
Joined: Nov 2021
Posts: 141 |
greetings folks im wondering how this code could be made smaller with less lines perhaps and yet still in 1 event
ON ^*:RAWMODE:#:{
if ($regex($1-,/([+-]Y|[+-]y|[+-]q|[+]a|[+-]h|[+-]o|[+-]v)/) && $regex($1-,/( $+ $me $+ )/)) {
if ($left($1,1) == +) { msg $chan thanks for the $replacex($right($1,1),Y,ojoin,y,oper,o,operator,h,halfop,a,admin,q,owner,v,voice) $nick $+ ! }
else { msg $chan why did u do that man why $+ $chr(44) i hate u for removing $replacex($right($1,1),Y,ojoin,y,oper,o,operator,h,halfop,a,admin,q,owner,v,voice)) $nick $+ ! }
}
}
thanks in advance
|
|
|
|
Joined: Jul 2006
Posts: 4,020
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,020 |
Hello, I'm afraid your code wrong, to say the least, this is not how you should use on rawmode to check if a mode apply to you, this code can even incorrectly triggers (if someone voice someone and set a mode +k with a key containing your nickname), not to mention that your nickname could contain character that could be interpreted by the regex engine, which would need to be sanitized anyway, but the correct solution does not involve regex, yes it's probably doable with regex but it's besides the point. Here is a code taken from this thread which I adapted: https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/39250/ON *:RAWMODE:#:{
var %takepara $remove($gettok($chanmodes,1-3,44),$chr(44)),%i 1,%j 2,%set 1
while ($mid($1,%i,1)) {
var %t $v1
if (%t == +) %set = 1
elseif (%t == -) %set = 0
elseif (%t isin $nickmode) {
var %nick = $eval($chr(36) $+ %j,2)
if ($istokcs(Y y q a o h v,%t,32)) && (%nick == $me) {
if (%set) { msg $chan thanks for the $replacex(%t,Y,ojoin,y,oper,o,operator,h,halfop,a,admin,q,owner,v,voice) $nick $+ ! }
else { msg $chan why did u do that man why $+ $chr(44) i hate u for removing $replacex(%t,Y,ojoin,y,oper,o,operator,h,halfop,a,admin,q,owner,v,voice)) $nick $+ ! }
}
inc %j
}
elseif (%t isin %takepara) inc %j
inc %i
}
}
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Nov 2021
Posts: 141
Vogon poet
|
OP
Vogon poet
Joined: Nov 2021
Posts: 141 |
Thanks Wims that seems to work well
|
|
|
|
|