mIRC Homepage
Posted By: Panic Scripters - 08/11/07 04:44 PM
Hello all

I am a rubish scripter so i would like you to help me out with a few text features for me bot. If you can help me i would like a script that when someone types *login it PM's them You are now logged in to CrazyMan at $address and then it messages #cmcontrol $nick has logged in < I will be changing this part later. I would also like one for *logout and it them pms the user You have not logged out and messages #cmcontrol $nick has logged out < I will be changing this later.

If you can also do this when someone called Panic or trollman118 types *botadmin It then says to the whole server or the rooms it is on $nick has identifed as a Bot Admin < I will be changing this later

Last thing how would i get the bot to ignore certain commands from people

Thanks
Panic
Posted By: Lpfix5 Re: Scripters - 08/11/07 07:22 PM
Code:
on *:TEXT:*:#:{
  if ($1 == *login) { 
    msg $nick You are now logged in to $me at $address($nick,3) 
    auser level $address($nick,3)  
    msg #cmcontrol $nick has logged in 
  }
  elseif ($1 == *logout) { 
    msg $nick You have logged out
    msg #cmcontrol $nick has logged out 
    ruser level $address($nick,3)
  } 
  elseif ($regex($nick,/([pP]anic|[tT]rollman118)/g) == 1) && ($1 == *botadmin) { 
    amsg $regml(1) has identifed as a Bot Admin
    auser level $address($regml(1),3)  
  }
}


You'll notice auser level and ruser level the (level) must be numeric and matching. The level you use here will only allow the users in question that are logged in to perform the commands on your bot that has that matching level

And for the *botadmin auser level You must change this one to nothing that matches regular user levels

So example lets say I make the regular users level 5 and do this

On 5:text:Moo*:#:I love it when we have cows in this room.

This would only work for people that are logged in to your bot while for others it wouldnt work.

So again everything you want to have your logged in users access the script needs to have matching level or higher.
Posted By: Panic Re: Scripters - 10/11/07 10:45 AM
Thanks

1 last thing though can i have a script that does not matter about levels and just text no add levels and stuff and with the *botadmin i only want it to do it with 2 nicks Panic and trollman118 no one other no add level

Thanks
Panic
Posted By: Lpfix5 Re: Scripters - 10/11/07 07:17 PM
Panic and trollman118 are the only ones for botadmin btw and you could just remove the auser and ruser commands

Code:
on *:TEXT:*:#:{
  if ($1 == *login) { 
    msg $nick You are now logged in to $me at $address($nick,3) 
    msg #cmcontrol $nick has logged in 
  }
  elseif ($1 == *logout) { 
    msg $nick You have logged out
    msg #cmcontrol $nick has logged out 
  } 
  elseif ($regex($nick,/([pP]anic|[tT]rollman118)/g) == 1) && ($1 == *botadmin) { 
    amsg $regml(1) has identifed as a Bot Admin
  }
}
Posted By: TropNul Re: Scripters - 11/11/07 10:23 AM
In this part of the code
Code:
elseif ($regex($nick,/([pP]anic|[tT]rollman118)/g) == 1) && ($1 == *botadmin) {

the regular expression could be replaced simply with this one:
Code:
elseif $regex($nick,/([pP]anic|[tT]rollman118)/) && ($1 == *botadmin) {

I mean that the /g modifier isn't necessary in this case.

smile


Posted By: Panic Re: Scripters - 11/11/07 10:26 AM
Thanks for all your help i have used this in my bot today great

Thank you
Panic
Posted By: genius_at_work Re: Scripters - 11/11/07 05:29 PM
There is no reason to use regex in this case at all.

A direct replacement:
Code:

if (($istok(panic trollman118,$nick,32)) && ($1 == *botadmin)) {




This is how I would do this in my code:

Code:

; Separate alias:
alias -l botadmins return panic trollman118

; In existing code:
if (($istok($botadmins,$nick,32)) && ($1 == *botadmin)) {



This method allows you to manage the botadmins by changing the space-delimited list in one location only. I usually put that /botadmins alias at the very top of my code so it is easy to locate.

-genius_at_work
© mIRC Discussion Forums