Salam , ma na aisay Short Snippet banai hay jisay app c haian to apna Bot ma dal ka , work kar saktay hain yah itni taze work karti ha jitna taze app ki CS karay gi !! :) , app log isay apna bots ka remote ma dal ka bhi work la saktay hain lakin op nick ki jaghan , operater ka nick hi mention kijya ga , warna her user user kar sakta hay , main channel ki jaghan app apna server ka main channel ka name likhin ga ..
or yah Sirf nick per ban karay gi !! ager app chaian to is ma time bhi add ker saktay ho !!
COMNDS ARE
.b nick
.ub nick
.i nick
.op
on 1:TEXT:*.i*:#:{ { if opnick* iswm $nick { /invite $$2 #mainchannel } }
on 1:TEXT:*.b*:#:{ { if opnick* iswm $nick { /mode $chan +b $$2 } }
on 1:TEXT:*.ub*:#:{ { if opnick* iswm $nick { /mode $chan -b $$2 | /msg $chan $$2 Iam behalf of this op, So plz dnt do this again :) } }
on 1:TEXT:*.op*:#:{ { if opnick* iswm $nick { /cs op $chan $me | /me say Thanks to me for aOp you } }
Linuxuser, that piece of code is absolutely riddled with syntax errors and incorrect usage of $regex(). you seem to be under the impression that $regex() returns a substring in the subject - basic testing would have revealed this to be false.
could you please test your scripts before posting them! slight oversights or errors related to exceptional cases are of course forgivable, but for a piece of example code to not work at all is just inexcusable. you want others to appreciate your examples, do you not?
and the number of lines in which we code something is perhaps the least important consideration imaginable. we could make this using 1 single line of code, or even script it without using the letter 'e'. but that would be silly right? :P
sunslayer's example is good: 'opnick*', presumably a constant, has been factored out of each if statement. the syntax is beginner-friendly and the logic is sound and easy to follow. it serves as a good introduction to the basics of mIRC scripting by showcasing those features that come up often. i think it is far more interesting to dig into our bag of tricks when the task is more complicated/advanced.
alias check { if ($regex(%reg,(ub|op) { set %reg $replace(%reg,ub,-b,op,+o) }
on @:TEXT::#:{ set %cmds invite ban -b +o
if ($regex($1,(i|b|ub|op)) { set %reg $regml(1) $+ \S+ | /check
if ($regex(%cmds,%reg)) && ($regex(%cmds,%reg) !== (-b|+o) { cs $regml(1) # $2 }
else { .mode # $regex(%cmds,%reg) $address($2,2) } }
may confuse you but all in one event and less lines than the other examples
on 1:TEXT:*:#: {
tokenize 32 $strip($1-)
if (opnick* !iswm $nick) { halt }
elseif ($1 == .i) { invite $$2 #mainchannel }
elseif ($1 == .b) { mode $chan +b $$2 }
elseif ($1 == .ub) { mode $chan -b $$2 | msg $chan $$2 Iam behalf of this op, So plz dnt do this again :) }
elseif ($1 == .op) { cs op $chan $me | me say Thanks to me for aOp you }
}
also keeping it at how you have it not changing it too much the on 1:TEXT:.i:#: could be done
on 1:TEXT:*:#: {
tokenize 32 $strip($1-)
if ($1 == .i) && (opnick* iswm $nick) { invite $$2 #mainchannel }
if ($1 == .b) && (opnick* iswm $nick) { mode $chan +b $$2 }
if ($1 == .ub) && (opnick* iswm $nick) { mode $chan -b $$2 | msg $chan $$2 Iam behalf of this op, So plz dnt do this again :) }
if ($1 == .op) && (opnick* iswm $nick) { cs op $chan $me | me say Thanks to me for aOp you
}
}
the tokenize line strips it of color and that is a better way of doing the command than 1:TEXT:.i:# <<< that way will pick up .i anywhere in a sentence ex. (hello .i am going to the mall.) if someone said that the bot would go and check see if the person can use the command and if they can use the command it will try to use it. the above way i showed won't just trigger at anytime it will only trigger if the first thing said is the command. not only that but it groups them all together so you dont have as many on text events.
on @$1:text:/^\.(?i)(i|u?b|op)\b/S:#:{
if (opnick* iswm $nick) && (!%p) {
var %2 $$2
goto $replace($regml(1),i,i,b,b,op,op,ub,ub)
:i | invite %2 # | halt
:b | $iif(%2 ison #,ban # %2 2,msg # * %2 is not on #) | halt
:op | cs op # $me | .describe # thanks to $nick | halt
:ub | mode # -b $address(%2,2)
msg # %2 On behalf of this op, your ban has been appealed and lifted :)
}
}
@HaLF_EviL
on 1:TEXT:*.i*:#:if (opnick* iswm $nick) { invite $$2 #mainchannel }
on 1:TEXT:*.b*:#:if (opnick* iswm $nick) { mode $chan +b $$2 }
on 1:TEXT:*.ub*:#:if (opnick* iswm $nick) { mode $chan -b $$2 | msg $chan $$2 Iam behalf of this op, So plz dnt do this again :) }
on 1:TEXT:*.op*:#:if (opnick* iswm $nick) { cs op $chan $me | me say Thanks to me for aOp you }
will work just fine
@Dean Dear idn t know English to much thad s y my Descrpition in urdu lanuage .. and one thing more i thin so thad u cant under stand op nick <-- it ment to say thad like ur op then this snipet is like that
on 1:TEXT:.i:#:{ { if Dean* iswm $nick { /invite $$2 #mainchannel } }
ithink so now u got it !!
i dont know what you mean by > ma na aisay Short Snippet banai hay jisay app c haian to apna Bot ma dal ka , work kar saktay hain yah itni taze work karti ha jitna taze app ki CS karay gi !! :) , app log isay apna bots ka remote ma dal ka bhi work la saktay hain lakin op nick ki jaghan , operater ka nick hi mention kijya ga , warna her user user kar sakta hay , main channel ki jaghan app apna server ka main channel ka name likhin ga ..
or yah Sirf nick per ban karay gi !! ager app chaian to is ma time bhi add ker saktay ho !! so... yeah.
Aleykum selam,
i dont know what you mean by
if opnick* iswm $nick
to be honest, i didnt understand all your description
the $opnick identifier will only receive a value on the "on op/op deop" event, which means the $opnick its the nick who received op or who was op removed
so you can use
if ($nick isop $chan) { command }
you need a check, to check if the person who is running the code is op on channel to set ban
i will not give an example of $regex, based on your script, cause it will confuse you