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.

addchannel on allvoive.tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
e
ein7opf
Voice
Posts: 19
Joined: Wed Aug 16, 2006 9:28 am

addchannel on allvoive.tcl

Post by ein7opf »

hi,
i have got a question about allvoice.tcl
the option is:

set avchan "" /// this means that allvoice is enabled on all channels.
set avchan "#channel" /// works only on inserted channel.

i want that autovice is enabled for 2 channels.
how can i add more than 1 channel?

i don`t know what i have to put in there to make it work.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

and we don't know what allvoice.tcl is
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
e
ein7opf
Voice
Posts: 19
Joined: Wed Aug 16, 2006 9:28 am

Post by ein7opf »

sorry. here is the script i`m talkin abot.

Code: Select all

## allvoice.tcl
##  - voices everyone in a channel when they join


# What channels should this work on?
#  - note, "" is for all channels
set avchan "" 

## Begin the code

bind join - * avjoin

proc avjoin {nick uhost hand chan} {
 global avchan botnick
 if {$nick == $botnick} {return 0}
 if {$avchan == "" && [botisop $chan]} {
  pushmode $chan +v $nick
  return 0
 }
 set chan [string tolower $chan]
 foreach i [string tolower $avchan] {
  if {$i == $chan && [botisop $chan]} {
   pushmode $chan +v $nick
   return 0
  }
 }
}

putlog "Loaded allvoice.tcl by guppy"
User avatar
dusk
Halfop
Posts: 91
Joined: Sun Mar 06, 2005 7:25 pm
Location: Belgium

Post by dusk »

I guess you just leave a space between two inserted chans.

Code: Select all

set avchan "#channel1 #channel2" 

GRTZ
me likes me eggie :P
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Something like this would be better:

Code: Select all

set avchat [list "#channel1" "#channel2"]
foreach really works much better on lists than strings..
Also, think lsearch would be faster than manually scanning through the whole list using foreach

Code: Select all

set avchan [list]
#set avchan [list [string tolower "#mychan"] [string tolower "#mychan2"]]
bind join - * avjoin

proc avjoin {nick uhost hand chan} {
 global avchan botnick
 if {$nick == $botnick} {return 0}
 set chan [string tolower $chan]
 if {[botisop $chan] && ([llength $avchan] == 0 || [lsearch $avchan $chan] >= 0)} {
  pushmode $chan +v $nick
  return 0
 }
} 
Anyway, using list when setting avchan would be mandatory (unless you really got a fetish of building valid list-structures manually ;) ), rewritten code is purely optional, guppy's original code should work fine I guess (or well, "string tolower" should'nt damage the list-structure, but that's just my guess..)
NML_375
e
ein7opf
Voice
Posts: 19
Joined: Wed Aug 16, 2006 9:28 am

Post by ein7opf »

hey, thank you for responding so fast.
both ways to put the channels in are causing a crashed down eggdrop.
your scipt works fine! thx for this great idea!
i think the problem is the name of one channel it have to work on.
the channelname includes specieal characters the channelname is #°o°.gn
and your postet script work on every channel except #°o°.gn
is there a way to make it work with these characters used in the channelname?

so long i allvoice all my channel.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Does the script crash, or does your whole eggdrop crash?

Extended character-sets have been an issue with eggdrop possibly since the beginning of times (well, sorta). Some older eggies had some seriuos issues with utf-8 and tcl, tho that's supposed to be somewhat solved now.

Unfortunately, I can't think of a quick-fix right now.
NML_375
e
ein7opf
Voice
Posts: 19
Joined: Wed Aug 16, 2006 9:28 am

Post by ein7opf »

when i use "allvoice.tcl" and try to add the channel #°o°.gn (in both ways of tryn to put in "chan1" "chan2" or "chan1 chan2") my my whole eggdrop chrashes down. when i use your script everything is fine but nothing happens on #°o°.gn when somebody joins. on every other channel it works fine.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

To summarize then; using list-commands on "broken" lists with extended charset crashes your bot. This means you've stumbled across a bug in either eggdrop or tcl.

Could you post some info on which version of eggdrop and tcl you're using. Also, if your bot generates any debug-info on crash, that would also be nice..
NML_375
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I would go for something less complicated than having to edit the .tcl file each time I want either to add or remove a channel from the *allvoice* channels list. I'd go for a user defined channel setting, like allvoice for instance, that can be enabled/disabled via dcc chat or telnet with the eggdrop.

Code: Select all

setudef flag allvoice

bind join - * avjoin

proc avjoin {nick uhost hand chan} {
  if {[isbotnick $nick] || ![channel get $chan allvoice] || ![botisop $chan]} {
    return
  }
  pushmode $chan +v $nick
}
Just ".chanset #channel +allvoice" to enable the *all voice* on a specific channel and to disable it.
Once the game is over, the king and the pawn go back in the same box.
e
ein7opf
Voice
Posts: 19
Joined: Wed Aug 16, 2006 9:28 am

Post by ein7opf »

i am running eggdrop V1.6.17
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@caesar: Nice one :) (Makes me wonder why I did'nt think of that myself)

2ein7opf: Well, think you've stumbled across a possible new utf-8 bug :/
Do you get any coredumps when it crashes? Any context-backtraces?
NML_375
e
ein7opf
Voice
Posts: 19
Joined: Wed Aug 16, 2006 9:28 am

Post by ein7opf »

thank you caesar. now everything is working fine.
thank all of you for quick responding and nice ideas.
Post Reply