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.

variable set

Help for those learning Tcl or writing their own scripts.
Post Reply
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

variable set

Post by NewzUK »

Hi - is there a way to set a variable just once when the bot starts up, but then does not get set again when there's a rehash?

Thanks in advance.
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

no, but there is an easy workaround:

Code: Select all

if {![info exists myvar]} {
   set myvar ""
}
Tip: this command can also be used to check if an array element exists.
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...
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

thanks De Kus - will give that a try.
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
Post Reply