egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

addchannel on allvoive.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
ein7opf
Voice


Joined: 16 Aug 2006
Posts: 19

PostPosted: Wed Aug 16, 2006 9:34 am    Post subject: addchannel on allvoive.tcl Reply with quote

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.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Wed Aug 16, 2006 12:08 pm    Post subject: Reply with quote

and we don't know what allvoice.tcl is
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
ein7opf
Voice


Joined: 16 Aug 2006
Posts: 19

PostPosted: Wed Aug 16, 2006 12:36 pm    Post subject: Reply with quote

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

Code:
## 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"
Back to top
View user's profile Send private message
dusk
Halfop


Joined: 06 Mar 2005
Posts: 91
Location: Belgium

PostPosted: Wed Aug 16, 2006 1:42 pm    Post subject: Reply with quote

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

set avchan "#channel1 #channel2"



GRTZ
_________________
me likes me eggie Razz
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Aug 16, 2006 2:42 pm    Post subject: Reply with quote

Something like this would be better:
Code:

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:

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 Wink ), 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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
ein7opf
Voice


Joined: 16 Aug 2006
Posts: 19

PostPosted: Wed Aug 16, 2006 8:26 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Aug 17, 2006 6:18 am    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
ein7opf
Voice


Joined: 16 Aug 2006
Posts: 19

PostPosted: Thu Aug 17, 2006 7:39 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Aug 17, 2006 11:16 am    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Aug 17, 2006 4:50 pm    Post subject: Reply with quote

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:

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.
Back to top
View user's profile Send private message
ein7opf
Voice


Joined: 16 Aug 2006
Posts: 19

PostPosted: Sat Aug 19, 2006 7:48 am    Post subject: Reply with quote

i am running eggdrop V1.6.17
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Aug 19, 2006 8:07 am    Post subject: Reply with quote

@caesar: Nice one Smile (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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
ein7opf
Voice


Joined: 16 Aug 2006
Posts: 19

PostPosted: Sat Aug 19, 2006 8:08 am    Post subject: Reply with quote

thank you caesar. now everything is working fine.
thank all of you for quick responding and nice ideas.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber