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 

setudef and channel set problem

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
x-treem
Voice


Joined: 21 Jul 2008
Posts: 9

PostPosted: Mon Jul 21, 2008 11:21 am    Post subject: setudef and channel set problem Reply with quote

hi, i'm tryign to make it work but i'm not able to get it. I have a script

Code:

bind pub * !info sendinfo
setudef flag sendinfo
channel set #infochan +sendinfo
proc info {nick uhost hand chan arg} {

if {[channel get $chan sendinfo]} {
....
} else {
return
}

but it's never triggering the if. [channel get $chan sendinfo] is always 0.
if i give a .chanset #infochan +sendinfo from the party line instead, it works....
is there a way to make it work with channel set?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jul 21, 2008 12:36 pm    Post subject: Reply with quote

Yes and no...
This is due to the channels-file feature in eggdrops.
Basically, it is an automatically generated tcl-script containing dynamic settings for all added channels, which is executed at the end of eggdrop's startup-cycle. Unfortunately, this means it will be executed after all scripts have been loaded, and will overrule any settings you specify in your script.

A workaround may be to use timer/utimer to delay the setting until everything has been loaded. Another option would be to not use the channels-file, with the drawback that any changes to channel-settings during runtime will be lost upon the next restart/rehash.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jul 21, 2008 1:35 pm    Post subject: Reply with quote

Code:
channel set #infochan +sendinfo

Get rid of that in the script, and instead put that line @ the end (after the source scripts section) of your eggdrop.conf and it'll work. But a person has to ask, why can't you simply .chanset #infochan +sendinfo on the partyline once that script is running? As that is the purpose of .chanset, to allow dynamic channel control while the script is running, without a need to .rehash or .restart ...
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
x-treem
Voice


Joined: 21 Jul 2008
Posts: 9

PostPosted: Mon Jul 21, 2008 1:55 pm    Post subject: Reply with quote

because i wanted to make the script "handly" to change adding a list of channels with that flag in just one line to have the script run also for that chan as needed instead of having to write it 10thousand times in the party line .chanset #chan1 blah blah .chanset #chan2 blah blah etc
Back to top
View user's profile Send private message
x-treem
Voice


Joined: 21 Jul 2008
Posts: 9

PostPosted: Mon Jul 21, 2008 2:21 pm    Post subject: Reply with quote

speechles wrote:
Code:
channel set #infochan +sendinfo

Get rid of that in the script, and instead put that line @ the end (after the source scripts section) of your eggdrop.conf and it'll work. But a person has to ask, why can't you simply .chanset #infochan +sendinfo on the partyline once that script is running? As that is the purpose of .chanset, to allow dynamic channel control while the script is running, without a need to .rehash or .restart ...


i tryed, now the end of my eggdrop.conf looks like
Code:

# uncomment (remove # in front of line) next line to activate
# source scripts/winident1.2.tcl

source scripts/infochan.tcl

channel set #testing +sendinfo


but it still doesnt work. channel get #testing addpre is always returning 0
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jul 21, 2008 2:24 pm    Post subject: Reply with quote

x-treem wrote:
because i wanted to make the script "handly" to change adding a list of channels with that flag in just one line to have the script run also for that chan as needed instead of having to write it 10thousand times in the party line .chanset #chan1 blah blah .chanset #chan2 blah blah etc


Wait, I'm not following..
Quote:
.chanset * +sendinfo

That turns it on for every single channel your bot is in.
Quote:
.chanset #thischan -sendinfo

That turns it off, for that single channel. Which if you used * above, will allow you to remove a few channels you don't want enabled. This is what you should be doing or remove that check entirely since you always want the script to work...

And what exactly is "handly"? A surname? A malapropism of "handy"? A foreign language term not immediately recognizable?

You mean you load the same script, except, multiple times with embedded chanset commands to activate each for each different channel? OMG.. wow, that is too much work my man. You are drowning your bot in redundant data (aka, slowing it down). Talk about doing things backwards. You have just defined that statement.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
x-treem
Voice


Joined: 21 Jul 2008
Posts: 9

PostPosted: Mon Jul 21, 2008 3:23 pm    Post subject: Reply with quote

mmm cant understand why of your answer. I'm new to TCL programming so i dont really know the "best" way to program a script right now i made a solution using times as you said before.

Code:

set infochan {"#testing" "#testing1"}
setudef flag sendinfo
set timerID [utimer 15 setchanflag]

proc setchanflag {} {
global timerID infochan
       foreach tchan $infochan {
               putlog "infochan - Setting flag for $tchan"
               channel set $tchan +sendinfo
       }
}


right now next expansion would be getting chanlist from a file and using some other command from chat to add channames to that filelist and automate everything.

thanks for your time
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jul 21, 2008 3:52 pm    Post subject: Reply with quote

x-treem wrote:
mmm cant understand why of your answer. I'm new to TCL programming so i dont really know the "best" way to program a script right now i made a solution using times as you said before.

Code:

set infochan {"#testing" "#testing1"}
setudef flag sendinfo
set timerID [utimer 15 setchanflag]

proc setchanflag {} {
global timerID infochan
       foreach tchan $infochan {
               putlog "infochan - Setting flag for $tchan"
               channel set $tchan +sendinfo
       }
}


right now next expansion would be getting chanlist from a file and using some other command from chat to add channames to that filelist and automate everything.

thanks for your time

you realize, the timer doesn't need to call that script.
Code:
set timerID1 [utimer 15 [list channel set #testing +sendinfo]]
set timerID2 [utimer 15 [list channel set #testing2 +sendinfo]]

The script itself should do the 'set udef' part. You do not need to do this again if the script is already loaded. You should be doing this all using the partyline and learning how to control eggdrop via it's normal methods, not scripting clumsy work arounds.. Wink
_________________
speechles' eggdrop tcl archive
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 -> Scripting Help 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