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.

utimer problem?

Help for those learning Tcl or writing their own scripts.
Post Reply
T
T-Xorcist
Halfop
Posts: 47
Joined: Mon Nov 14, 2005 6:36 pm
Location: Netherlands
Contact:

utimer problem?

Post by T-Xorcist »

I have this script:

Code: Select all

putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
putquick "PRIVMSG #bots :Joining \002$chan\002 - Invited in by \002$nick\002"
channel add $chan
utimer 10 [putquick "PRIVMSG OperServ :mode $chan +o $botnick"]
It is about the last sentence, that utimer.
Sometimes it works (it IMMEDIATELY send it to operserv, not 10 seconds), and sometime it doesn't work at all.

Can anyone explain what I am doing wrong here?

Thanks in advance,

T-Xorcist
n
nANDu
Voice
Posts: 15
Joined: Sun May 22, 2005 1:05 am

Post by nANDu »

Code: Select all

utimer 10 [list putquick "PRIVMSG OperServ :mode $chan +o $botnick"]
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

utimer 10 {putquick "PRIVMSG OperServ :mode $chan +o $botnick"}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
T
T-Xorcist
Halfop
Posts: 47
Joined: Mon Nov 14, 2005 6:36 pm
Location: Netherlands
Contact:

Post by T-Xorcist »

nANDu wrote:

Code: Select all

utimer 10 [list putquick "PRIVMSG OperServ :mode $chan +o $botnick"]
This 1 works fine. What is the difference with yours demond?

What is the "official" way?

And can I build an IF function into a timer? :oops: Is that possible?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

no difference, they are equivalent, I was a bit late on "Submit" button

put your if logic in a proc, run that proc by timer
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
T
T-Xorcist
Halfop
Posts: 47
Joined: Mon Nov 14, 2005 6:36 pm
Location: Netherlands
Contact:

Post by T-Xorcist »

How do I do this exacly :$

I have this:

Code: Select all

utimer 4 [list check:ops $chan $nick]
and tried this:

Code: Select all

utimer 4 [list check:ops]
And it MUST go to this procedure:

Code: Select all

proc check:ops {nick host hand text} {
  if {([isop $nick $chan])} {
    putquick "PRIVMSG OperServ :mode $chan +o $botnick"]
  } else {
    putquick "PRIVMSG $chan :Leaving channel... (Requester doesn't have ops) \002#bots\002"
    channel remove $chan
  }
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you MUST pass to [utimer] all the arguments your proc needs:

Code: Select all

proc foo {x y z} {
...
}

...

utimer $t [list foo $x $y $z]
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
T
T-Xorcist
Halfop
Posts: 47
Joined: Mon Nov 14, 2005 6:36 pm
Location: Netherlands
Contact:

Post by T-Xorcist »

so:

Code: Select all

utimer 4 [list check:ops $nick $host $hand $text]
All of this?

I tried this one aswell:

Code: Select all

putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
putquick "PRIVMSG #bots :Joining \002$chan\002 - Invited in by \002$nick\002"
channel add $chan
utimer 4 {
  if {([isop $nick $chan])} {
    putquick "PRIVMSG OperServ :mode $chan +o $botnick"]
  } else {
    putquick "PRIVMSG $chan :Leaving channel... (Requester doesn't have ops) \002#bots\002"
    channel remove $chan
  }
}
But that doesn't seem to work :(
Anyone?
n
nANDu
Voice
Posts: 15
Joined: Sun May 22, 2005 1:05 am

Post by nANDu »

Pls read what demond posted again

Code: Select all

proc check:ops {nick host hand text} { 
   if {([isop $nick $chan])} { 
   ......
   ......
   }
}

Code: Select all

....
....
putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
putquick "PRIVMSG #bots :Joining \002$chan\002 - Invited in by \002$nick\002"
channel add $chan
utimer 4 [list check:ops $nick $host $hand $text]
T
T-Xorcist
Halfop
Posts: 47
Joined: Mon Nov 14, 2005 6:36 pm
Location: Netherlands
Contact:

Post by T-Xorcist »

As you can read, I allready tried this, but it doesn't work...

I get these two lines in my error log:

Code: Select all

[23:10] Tcl error in script for 'timer2':
[23:10] extra characters after close-quote
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

T-Xorcist wrote:How do I do this exacly :$

I have this:

Code: Select all

utimer 4 [list check:ops $chan $nick]
and tried this:

Code: Select all

utimer 4 [list check:ops]
And it MUST go to this procedure:

Code: Select all

proc check:ops {nick host hand text} {
  if {([isop $nick $chan])} {
    putquick "PRIVMSG OperServ :mode $chan +o $botnick"]
  } else {
    putquick "PRIVMSG $chan :Leaving channel... (Requester doesn't have ops) \002#bots\002"
    channel remove $chan
  }
}
Use

Code: Select all

utimer 4 [list check:ops $chan $nick]
and

Code: Select all

proc check:ops {chan nick} {
 global botnick
 if {([isop $nick $chan])} {
  putquick "PRIVMSG OperServ :mode $chan +o $botnick"
 } else {
  putquick "PRIVMSG $chan :Leaving channel... (Requester doesn't have ops) \002#bots\002"
  channel remove $chan
 }
}
T
T-Xorcist
Halfop
Posts: 47
Joined: Mon Nov 14, 2005 6:36 pm
Location: Netherlands
Contact:

Post by T-Xorcist »

Well Sir_Fz, it goes to that procedure... thanks for that.

Only.. It allways say that I haven't got @ in the channel, and then parts.

Do you have any idea of what I am doing wrong? I guess the code is ok?

if I do this:

Code: Select all

} else {
    putquick "PRIVMSG $chan :Nick = $nick"
    putquick "PRIVMSG $chan :Chan = $chan"
    putquick "PRIVMSG $chan :Leaving channel... (Requester doesn't have ops) \002#bots\002"
    channel remove $chan
  }
It does give me the right nickname and channel.
Post Reply