Short key

By HaLF_EviL on Mar 12, 2011

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  } }

Comments

Sign in to comment.
sunslayer   -  Mar 15, 2011

There also seems to be quite a few bracket missing and ambiguous if statements

 Respond  
jaytea   -  Mar 15, 2011

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.

 Respond  
Linuxuser   -  Mar 15, 2011

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

 Respond  
Jethro   -  Mar 12, 2011

lol Yes, you only need one for if opnick* iswm $nick :P

 Respond  
sunslayer   -  Mar 12, 2011

my mistake :p fixed

 Respond  
blackvenomm666   -  Mar 12, 2011

umm sunslayer why would you put the halt after if opnick iswm $nick? he had it set to make it work if that line is true not halt.

 Respond  
sunslayer   -  Mar 12, 2011
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 }
}
 Respond  
blackvenomm666   -  Mar 12, 2011

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.

 Respond  
HaLF_EviL   -  Mar 12, 2011

@soulmubcher ? did u try this ? sniipet?

 Respond  
SoulMuncher   -  Mar 12, 2011

this is pretty bad

 Respond  
_Dean_   -  Mar 12, 2011

i didnt understand what u said ._.

 Respond  
HaLF_EviL   -  Mar 12, 2011

@dean App kis server ka owner ho ?

 Respond  
Jethro   -  Mar 12, 2011

You know, stop your sarcasm and shove it.

 Respond  
Jethro   -  Mar 12, 2011

As a human, I missed the variable. Edited.

 Respond  
_Dean_   -  Mar 12, 2011

im just confused with the var %2 on ur example Jethro_, what is made for? since it was not set on the entire script...

all it returns is

<~Dean> .b nick
<&Botname> * is not on #channel

i dont want to pay copyrights for the $regex thats why

 Respond  
Jethro   -  Mar 12, 2011

Dean go away with your bitterness. I'm just showing my way of doing something. Unlike you, you've always been critical of those who post their versions of example, thinking those who demonstrate something out of ordinary, they're show-offs. Don't be so narrow-minded for once in your life.

 Respond  
HaLF_EviL   -  Mar 12, 2011

Dean iam newbie on this web will u help me ?

 Respond  
HaLF_EviL   -  Mar 12, 2011

@jethro Bro Doin gud job !

 Respond  
_Dean_   -  Mar 12, 2011

^ the opportunist, as i said, a $regex example can confuse him, just based on his way of scripting
Jethro_ can u offer to him a version that its not regex?

 Respond  
Jethro   -  Mar 12, 2011
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 :)
  }
}
 Respond  
sunslayer   -  Mar 12, 2011

@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

 Respond  
HaLF_EviL   -  Mar 12, 2011

@Dean if ($nick isop $chan) { command } <-- if iam use this , the u must be @ <-- on active mode other wise its not work =) , or if u use my comand then if u are not in acctive mode but my comand work :) just u type a short key with out active mode its works

 Respond  
HaLF_EviL   -  Mar 12, 2011

@ sunslayer , My DEAR , these braceses it too neccesesry if u use this snippet then u know !! .. =)

 Respond  
HaLF_EviL   -  Mar 12, 2011

@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 !!

 Respond  
sunslayer   -  Mar 12, 2011

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.

 Respond  
_Dean_   -  Mar 12, 2011

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

 Respond  
sunslayer   -  Mar 12, 2011

there's also redundant curly braces

 Respond  
Hermes   -  Mar 12, 2011

do u know u can remove the / before the commands? :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.