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.

return a value in a timed event

Old posts that have not been replied to for several years.
Locked
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

return a value in a timed event

Post by Dedan »

I have a problem with eggdrop setting a value in a timed event.
the below works fine until the timer times out and tries to
unset the var. it can not find the value of "$av_temp"
I just want to unset the varaible.

<Zia> [07:54] Tcl error in script for 'timer49':
<Zia> [07:54] can't read "av_temp": no such variable

Any ideas?

Code: Select all

set voice_ban_time 7


proc voice:cntrl {stuff} {
  global botnick stuff
 
  set av_temp [getchanhost $victim $chan]
  set voice_ban([lindex [split $av_temp @] end]) 1
  timer $voice_ban_time {unset voice_ban([lindex [split $av_temp @] end])}
}

I once was an intelligent young man, now i am old and i can not remember who i was.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This is because your timer command is surounded in brackets.

These brackets delay the parsing of the linud command until the timer triggers.

Somthing like this will fix it

Code: Select all

timer $voice_ban_time [list unset voice_ban([lindex [split $av_temp @] end])]
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

try

Code: Select all

timer $voice_ban_time [list unset voice_ban([lindex [split $av_temp @] end])]
edit: Sorry, ppslim was faster in reply :P
Last edited by Sir_Fz on Mon Oct 06, 2003 2:21 pm, edited 1 time in total.
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

thanks ppslim and Sir Fz :D
I once was an intelligent young man, now i am old and i can not remember who i was.
Locked