This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Trasform "Bind Pub" in "Bind Join"

Old posts that have not been replied to for several years.
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

Trasform "Bind Pub" in "Bind Join"

Post by saerd »

Hi all i need to trasform Bind Pub in Bind Join:

bind pub n !opscan scan_ops

proc scan_ops {nick uhost hand chan text} {
global botnick chan1 chan2 chan3 chan4 chan5
........ code ........
}

i would start the proc "scan_ops" on join, using bind join.

bind join - * join:scan_ops
proc scan_ops {nick uhost hand chan text} {
........ the same code ........
}

but i have problem; how i can do ?

thanks!
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

posting your entire code here (using BBcode tags) would be a good start
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Code: Select all

    (4)  PUB
         bind pub <flags> <command> <proc>
         procname <nick> <user@host> <handle> <channel> <text>

         Description: used for commands given on a channel. The first word
           becomes the command and everything else is the text argument.
         Module: irc

    (6)  PUBM (stackable)
         bind pubm <flags> <mask> <proc>
         procname <nick> <user@host> <handle> <channel> <text>

         Description: just like MSGM, except it's triggered by things said
           on a channel instead of things /msg'd to the bot. The mask is
           matched against the channel name followed by the text and can
           contain wildcards. Also, if a line triggers a PUB bind, it will not
           trigger a PUBM bind.
         Module: irc

    (8)  JOIN (stackable)
         bind join <flags> <mask> <proc>
         procname <nick> <user@host> <handle> <channel>

         Description: triggered by someone joining the channel. The mask in
           the bind is matched against "#channel nick!user@host" and can
           contain wildcards.
         Module: irc
As you see "bind join" doesn't have "text" argument at the end, so it will not work in that way.
Que?
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

Post by saerd »

thanks for the fast replies!!! :D :D :D

i post the code (taken from this forum :P :P )

Code: Select all

### Settings ### 

#This will be the channel where the opped users will be detected on. 
set chan1 "#opchannel" 

#This will be the channel to op the people on. 
set chan2 "#chanforop" 


### Don't edit anything below this! ### 

bind pub n !opscan scan:ops 

proc scan:ops {nick uhost hand chan text} { 
 global botnick chan1 chan2 
  if {(![validchan $chan1]) || (![validchan $chan2])} { return 0 } 
  if {(![string equal -nocase $chan $chan1]) || (![string equal -nocase $chan $chan2])} { return 0 } 
  putserv "PRIVMSG $chan1 :Scanning..."; set oplist [list] 
  foreach user [chanlist $chan1] { 
   if {([onchan $user $chan1]) && ([onchan $user $chan2])} { 
    lappend oplist $user 
    } 
   } 
   putserv "PRIVMSG $chan1 :Scanning completed." 
   if {([llength $oplist] >= 1) && ([botisop $chan2])} { 
   putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan2." 
    foreach person $oplist { 
     pushmode $chan2 +o $person 
    } 
    flushmode $chan2 
    putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] has/have been successfully opped on $chan2. 
  } 
 return 0 
} 
i would that this scan "start" on join #CHAN1.

many thanks in advance :D
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

You can try to add this to your code:

Code: Select all

bind join - * join:scan:ops
proc join:scan:ops {nick uhost hand chan} {
  scan:ops $nick $uhost $hand $chan ""
}
Que?
o
overfly
Voice
Posts: 8
Joined: Fri Jan 07, 2005 6:02 am

Post by overfly »

KrzychuG wrote:You can try to add this to your code:

Code: Select all

bind join - * join:scan:ops
proc join:scan:ops {nick uhost hand chan} {
  scan:ops $nick $uhost $hand $chan ""
}
When i do this, the Bot alway scans chan1 and chan2. How can I make him scan only chan1 ?

Is ist possible with this script to habe him scan chan1 & chan2 and op these operators in channel3 ? So just to make it work for 2 Channels to scan?
Thx
Greetz
overfly
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yes it is possible todo so. I beleive I made the script let's see if we can alter it. I beleive this will do it:

Code: Select all

### Settings ###

#This will be the channel 1 where the opped users will be detected on.
set chan1 "#opchannel"

#This will be the channel 2 where the opped users will be detected on.
set chan2 "#channel1"

#This will be the channel to op the people on.
set chan3 "#channel2"

### Don't edit anything below this! ###

bind join - * scan:ops

proc scan:ops {nick uhost hand chan} {
 global botnick chan1 chan2 chan3
  if {![validchan $chan1] || ![validchan $chan2] || ![validchan $chan3]} { return 0 }
  if {![string equal -nocase $chan $chan1] || ![string equal -nocase $chan $chan2] || ![string equal -nocase $chan $chan3]} { return 0 }
  putserv "PRIVMSG $chan1 :Scanning $chan1..."; set oplist [list]
  foreach user [chanlist $chan1] {
   if {[onchan $user $chan1] && [onchan $user $chan3]} {
    lappend oplist $user
    }
   }
   putserv "PRIVMSG $chan1 :Scanning completed for $chan1."
   if {([llength $oplist] >= 1) && ([botisop $chan3])} {
   putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan3."
    foreach person $oplist {
     pushmode $chan3 +o $person
    }
    flushmode $chan3
    putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] on $chan1 have been successfully opped on $chan3.
  }
  putserv "PRIVMSG $chan2 :Now scanning $chan2..."; set newoplist [list]
  foreach newuser [chanlist $chan2] {
   if {[onchan $user $chan2] && [onchan $user $chan3]} {
    lappend newoplist $newuser
    }
   }
   putserv "PRIVMSG $chan2 :Scanning completed for $chan2."
   if {([llength $newoplist] >= 1) && ([botisop $chan3])} {
   putserv "PRIVMSG $chan1 :Now opping all users on $chan2 to $chan3."
    foreach newperson $newoplist {
     pushmode $chan3 +o $newperson
    }
    flushmode $chan3
    putserv "PRIVMSG $chan2 :Nick(s) [join $newoplist {, }] on $chan2 have been successfully opped on $chan3.
  }
 unset oplist; unset newoplist; return 0
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
o
overfly
Voice
Posts: 8
Joined: Fri Jan 07, 2005 6:02 am

Post by overfly »

awyeah wrote:Yes it is possible todo so. I beleive I made the script let's see if we can alter it. I beleive this will do it:

Code: Select all


    putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] on $chan1 have been successfully opped on $chan3."
  }
  
Thx awyeah 4 helping ...
Beside the 2 missing " at the End of both putserv Lines, somehow the script isn`t doing something. :-/

Greetz
overfly
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yeah, I missed the quotation marks in a hurry. Simple syntax errors should be fixed and identified with no problem. However as for the script what error do you get?

How come it doesn't perform anything? You do not get the channel messages, stating.. "Scanning...." or "Opping all users...." ??
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
o
overfly
Voice
Posts: 8
Joined: Fri Jan 07, 2005 6:02 am

Post by overfly »

awyeah wrote: How come it doesn't perform anything? You do not get the channel messages, stating.. "Scanning...." or "Opping all users...." ??
It`s sad but true. No errors and no messages at all. Sry, but its the truth!!!
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

Code: Select all

  if {![string equal -nocase $chan $chan1] || ![string equal -nocase $chan $chan2] || ![string equal -nocase $chan $chan3]} { return 0 } 
change the "||"s to "&&".
otherwise it would only work if chan1 == chan2 == chan3 :)
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
o
overfly
Voice
Posts: 8
Joined: Fri Jan 07, 2005 6:02 am

Post by overfly »

arcane wrote: change the "||"s to "&&".
otherwise it would only work if chan1 == chan2 == chan3 :)
That was it....

But the Bot is only checking when he`s opped in every channel. Hmm.... how can i fix that?
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

awyeah's script only checks for op in $chan3.
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Only, use this:

if {![string equal -nocase $chan $chan3]} { return 0 }

Meaning, that you have to supply the trigger on channel3, the channel where you want to op the people on.

And remove this line as well it is not of much use:
if {![validchan $chan1] || ![validchan $chan2] || ![validchan $chan3]} { return 0 }

I'd say we fix this up. Now the bot will only check if the trigger is on #chan3 (meaning bot is present on the #chan3) and if bot is opped on #chan3 and if the bot is present on all three channels (#chan1, #chan2, #chan3) - using negative logics, then only go ahead and run the script further. Try this:

(Also added a small peice of condition code to check if the nick is already opped on #chan3, then do not op it again)

Code: Select all

### Settings ###

#This will be the channel 1 where the opped users will be detected on.
set chan1 "#op-channel1"

#This will be the channel 2 where the opped users will be detected on.
set chan2 "#op-channel2"

#This will be the channel to op the people on.
set chan3 "#trigger-channel"

### Don't edit anything below this! ###

bind join - * scan:ops 

proc scan:ops {nick uhost hand chan} {
 global botnick chan1 chan2 chan3
  if {![string equal -nocase $chan $chan3] || ![botisop $chan3]} { return 0 }
  if {![botonchan $chan1] || ![botonchan $chan2] || ![botonchan $chan3]} { return 0 }
  putserv "PRIVMSG $chan1 :Scanning $chan1..."; set oplist [list]
  foreach user [chanlist $chan1] {
   if {[onchan $user $chan1] && [onchan $user $chan3] && ![isop $user $chan3]} {
    lappend oplist $user
    }
   }
   putserv "PRIVMSG $chan1 :Scanning completed for $chan1."
   if {([llength $oplist] >= 1) && ([botisop $chan3])} {
   putserv "PRIVMSG $chan1 :Opping all users on $chan1 to $chan3."
    foreach person $oplist {
     pushmode $chan3 +o $person
    }
    flushmode $chan3
    putserv "PRIVMSG $chan1 :Nick(s) [join $oplist {, }] on $chan1 have been successfully opped on $chan3.
  }
  putserv "PRIVMSG $chan2 :Now scanning $chan2..."; set newoplist [list]
  foreach newuser [chanlist $chan2] {
   if {[onchan $newuser $chan2] && [onchan $newuser $chan3] && ![isop $newuser $chan3]} {
    lappend newoplist $newuser
    }
   }
   putserv "PRIVMSG $chan2 :Scanning completed for $chan2."
   if {([llength $newoplist] >= 1) && ([botisop $chan3])} {
   putserv "PRIVMSG $chan1 :Now opping all users on $chan2 to $chan3."
    foreach newperson $newoplist {
     pushmode $chan3 +o $newperson
    }
    flushmode $chan3
    putserv "PRIVMSG $chan2 :Nick(s) [join $newoplist {, }] on $chan2 have been successfully opped on $chan3.
  }
 unset oplist; unset newoplist; return 0
} 
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

awyeah wrote: And remove this line as well it is not of much use:
if {![validchan $chan1] || ![validchan $chan2] || ![validchan $chan3]} { return 0 }
I'd leave that line in.
doesn't hurt to check for that, but will prevent getting errors.
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
Locked