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.

+R Script

Old posts that have not been replied to for several years.
User avatar
mcdarby
Halfop
Posts: 69
Joined: Tue Jul 16, 2002 7:46 pm
Location: Bangor, Pennsylvania
Contact:

+R Script

Post by mcdarby »

Hi, I was thinking of putting +R in channel and having a TCL Script for when the BotServ bot goes offline or disappears from channel (when services is down temporary) that eggdrop removes +R from the channel modes and when the BotServ bot comes back, resets +R in channel. The +R forces people to register and identify with NickServ to be able to join the channel and the reason for needing this script that removes +R when services is down is because +R with services down prevents people from joining the channel. I would also like to find this script as being channel pacific as the bot is in several channels and don't want it placing +R in all those channels, especially channels not registered with ChanServ. If there is a script that can work like this, please let me know.

Sincerely,

Erik
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

How does the bot leave the channel(s)?
s
stammer
Voice
Posts: 31
Joined: Mon Mar 10, 2003 9:39 am
Location: Bulgaria

Post by stammer »

try to bind 'splt' and 'part' to trigger a procedure for setting that mode for example:

Code: Select all

bind part - *      pub:spart
bind splt - *      pub:ssplit
hope this helps
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

stammer wrote:try to bind 'splt' and 'part' to trigger a procedure for setting that mode for example:

Code: Select all

bind part - *      pub:spart
bind splt - *      pub:ssplit
hope this helps
ok, where are the procs ? pub:spart and pub:ssplit.
your code means nothing unless u modify the procs.
User avatar
MD87
Voice
Posts: 23
Joined: Sat Dec 14, 2002 9:04 am
Location: Leicester, UK
Contact:

Post by MD87 »

Sir_Fz wrote:ok, where are the procs ? pub:spart and pub:ssplit.
your code means nothing unless u modify the procs.
Some people may learn better if they're not spoon-fed ;)

Anyway, I'd use something like this:

Code: Select all

# Name of the botservice
set botservicenick "X"

bind splt -|- * checkR:gone
bind sign -|- * checkR:gone

proc checkR:gone { nick uhost handle channel args } {
  if { $nick == $::botservicenick } {
    pushmode $channel -R
  }
}

bind join -|- * checkR:back
bind rejn -|- * checkR:back

proc checkR:back { nick uhost handle channel } {
  if { $nick == $::botservicenick } {
    pushmode $channel +R
  }
}
Webmaster, MD87.co.uk
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Well that's better :)
and I don't know how to create that proc :P

but does this code work when Botserv quits for a reason (Lag or something) ? cuz I think it only works in case of a nwtwork split.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

For static nicks/hostmasks it's much better to do the "filtering" on bind level, so include the nick and/or hostmask in the bind and drop the check inside the proc.

Sir_Fz: The sign bind takes care of other quits

If you've set "wait-split" very low, the splt bind's not needed because sign (quit) is triggered $wait-split seconds later.
If the service bot never parts the channel, get rid of the part bind :P

Code: Select all

# change this to match the service bot
set serviceBot nick!ident@host

bind splt - "% $serviceBot" mode-R
bind sign - "% $serviceBot" mode-R
bind part - "% $serviceBot" mode-R
bind join - "% $serviceBot" mode+R

# use '.chanset #chan +R' to enable on a channel
setudef flag R

proc mode-R {n u h c {a ""}} {
	if {[channel get $c R]&&[string match *R* [lindex [split [getchanmode $c]] 0]]} {
		pushmode $c -R
	}
}
proc mode+R {n u h c} {
	if {[channel get $c R]&&![string match *R* [lindex [split [getchanmode $c]] 0]]} {
		pushmode $c +R
	}
}
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

user wrote: [snip]
proc mode+R {n u h c} {
if {[channel get $c R]&&![string match *R* [lindex [split [getchanmode $c]] 0]]} {
pushmode $c +R
}
}
[/code]
Throw in a "!" somewhere :P
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

egghead wrote:Throw in a "!" somewhere :P
Where?
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

user wrote:
egghead wrote:Throw in a "!" somewhere :P
Where?
nvm ... too much wine on an evening :\

Got confused with the channel mode "+R", the setting on the bot "+R" and the naming of the proc.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

egghead wrote:Actually, I'm getting a bit confused of your use of the user defined flag "R"... :\
I'm sorry :P I couldn't find a different (short) name for it...do you have any suggestions?

EDIT: I ditn't fake that quote. He changed his post ;P
Last edited by user on Wed Jul 02, 2003 5:41 pm, edited 1 time in total.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

user wrote:I'm sorry :P I couldn't find a different (short) name for it...do you have any suggestions?
+/-restricted
+/-needregister
+/-userneedregister
+/-userneedregisterbeforejoin
+/needsomesleep
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

user wrote:
egghead wrote:Actually, I'm getting a bit confused of your use of the user defined flag "R"... :\
I'm sorry :P I couldn't find a different (short) name for it...do you have any suggestions?

EDIT: I ditn't fake that quote. He changed his post ;P
hehe... true. unfortunately slennox disabled the option to "delete" postings, where one could read reactions on postings that were already purged.
User avatar
mcdarby
Halfop
Posts: 69
Joined: Tue Jul 16, 2002 7:46 pm
Location: Bangor, Pennsylvania
Contact:

Post by mcdarby »

user wrote:For static nicks/hostmasks it's much better to do the "filtering" on bind level, so include the nick and/or hostmask in the bind and drop the check inside the proc.

Sir_Fz: The sign bind takes care of other quits

If you've set "wait-split" very low, the splt bind's not needed because sign (quit) is triggered $wait-split seconds later.
If the service bot never parts the channel, get rid of the part bind :P

Code: Select all

# change this to match the service bot
set serviceBot nick!ident@host

bind splt - "% $serviceBot" mode-R
bind sign - "% $serviceBot" mode-R
bind part - "% $serviceBot" mode-R
bind join - "% $serviceBot" mode+R

# use '.chanset #chan +R' to enable on a channel
setudef flag R

proc mode-R {n u h c {a ""}} {
	if {[channel get $c R]&&[string match *R* [lindex [split [getchanmode $c]] 0]]} {
		pushmode $c -R
	}
}
proc mode+R {n u h c} {
	if {[channel get $c R]&&![string match *R* [lindex [split [getchanmode $c]] 0]]} {
		pushmode $c +R
	}
}
Okay, a test of that script returned the following errors.

.chanset #ForestHaven +R
Successfully set modes { +R } on #Channel.
[21:08] #ErikMouse# chanset #Channel +R
[21:09] Tcl error [mode-R]: unknown channel command: should be one of: add, set, info, remove
[21:10] @#Channel (+ctn) : [m/5 o/3 v/2 n/0 b/55 e/- I/-]
[21:10] Tcl error [mode+R]: unknown channel command: should be one of: add, set, info, remove

--
McDarby
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

mcdarby wrote: [21:09] Tcl error [mode-R]: unknown channel command: should be one of: add, set, info, remove
That's because you're running an old version of eggdrop.

replace

Code: Select all

[channel get $c R]
with

Code: Select all

[lsearch [channel info $c] +R]>-1
Locked