mIRC Home    About    Download    Register    News    Help

Print Thread
Scripters #189533 08/11/07 04:44 PM
Joined: Aug 2007
Posts: 41
P
Panic Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Aug 2007
Posts: 41
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

Last edited by Panic; 08/11/07 04:45 PM.

CrazyMan IRC Bot Admin
IRC UnGoWa Support
NeoBlab Server-Admin
Chat Operator
Re: Scripters [Re: Panic] #189547 08/11/07 07:22 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Scripters [Re: Lpfix5] #189646 10/11/07 10:45 AM
Joined: Aug 2007
Posts: 41
P
Panic Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Aug 2007
Posts: 41
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


CrazyMan IRC Bot Admin
IRC UnGoWa Support
NeoBlab Server-Admin
Chat Operator
Re: Scripters [Re: Panic] #189674 10/11/07 07:17 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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
  }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Scripters [Re: Lpfix5] #189725 11/11/07 10:23 AM
Joined: May 2007
Posts: 89
T
TropNul Offline
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
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




tropnul
Re: Scripters [Re: TropNul] #189727 11/11/07 10:26 AM
Joined: Aug 2007
Posts: 41
P
Panic Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Aug 2007
Posts: 41
Thanks for all your help i have used this in my bot today great

Thank you
Panic


CrazyMan IRC Bot Admin
IRC UnGoWa Support
NeoBlab Server-Admin
Chat Operator
Re: Scripters [Re: TropNul] #189755 11/11/07 05:29 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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