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.

yet another timer problem

Old posts that have not been replied to for several years.
Locked
A
Acio
Voice
Posts: 2
Joined: Sat Jun 25, 2005 7:38 pm

yet another timer problem

Post by Acio »

Ola,

I have a problem with a timer command.

when I call utimer as a loop it whines to me about missing arguments.

here is the script:

proc txt1 {nick host hand chan arg} {
global basechan handle interval
if {$chan != $basechan} {
return 0
}
if {[file exists /home/acio/eggdrop/text/txt1.txt]} {
set o_fid [open "/home/acio/eggdrop/text/txt1.txt" "RDONLY"]
gets $o_fid txt1msg
close $o_fid
set channelzahl 0
foreach c [channels] {
if {[strlwr $c] != [strlwr $basechan]} {
incr channelzahl
}
}
if {[string match "*NICK*" $txt1msg]} {
set txt1msg [varrep $txt1msg "NICK" $nick]
}
putserv "PRIVMSG $chan :\[$handle-announcer\] txt1 broadcast msg: $txt1msg"
putserv "PRIVMSG $chan :\[$handle-announcer\] is beeing send to $channelzahl channels with an interval of $interval seconds! Watch chanlist with !showchans."
set i 0
foreach c [channels] {
if {[strlwr $c] != [strlwr $basechan]} {
utimer $interval [list puthelp "PRIVMSG $c :$txt1msg"]
incr i }
}
} else {
putserv "PRIVMSG $chan :\[$handle-announcer\] Error: File not found / no message set"
}
utimer 30 txt1}
here is what happens if I try it..

[03:08] Tcl error in script for 'timer2':
[03:08] wrong # args: should be "txt1 nick host hand chan arg"

I've tried pretty much everything. when I add txt1 to the list it just tells me to add another one..

on a sidenote the rest works fine. I just want it to recurr every X minutes (yes I know that utimer does seconds, it's just for testing purposes)

does anyone have an idea?

cous i'm lost :/

Tried looking online for over 5 hours..haha..

Thanks in advance!
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

these 2 lines cause the error in there combination:

proc txt1 {nick host hand chan arg}
utimer 30 txt1

the utimer is calling txt1 without no arguments, but 5 are needed. and even if it would be called with 5 empty arguments, it would simply stop here: $chan != $basechan
you should at least forward $nick and $chan
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
A
Acio
Voice
Posts: 2
Joined: Sat Jun 25, 2005 7:38 pm

Post by Acio »

ah,

and how would I go about doing that?

i'm not really into this whole tcl programming yet..(read noobie) :)

I tried putting the arguments after calling txt1 in brackets but its still whining about wanting txt1 in it too..:/

thanks in advance
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

txt1 needs 5 args to be passed into it when called. So if you want to call the proc txt1 you'll need to do it this way:

Code: Select all

txt1 bla bla2 bla3 bla4 bla5
but ofcourse you'll have to specify something useful in these arguments, you'll need atleast a nick and a chan for your code.

Code: Select all

txt1 somenick * * somechan *
but I think it'll be redundant anyway.
Locked