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 

[SOLVED] catch errors, dont make eggy die
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Mar 24, 2010 5:41 pm    Post subject: Reply with quote

The code still expects the supplied data to be a list, so using a string with the loadscript proc would still be "improper". Still, as long as you're very careful, you'll be safe.

The list commands used with uplevel (since user's fix) is used to avoid something known as double-evaluation, it does not affect the data passed to the foreach command, which still has to be a valid list.

The problem you are facing with "set scripts [list ... ]" is that you don't properly escape the newline character using \
Wrong:
Code:
set scripts [list
scripts/script1.tcl
scripts/script2.tcl
scripts/script3.tcl
]

Correct:
Code:
set scripts [list \
scripts/script1.tcl \
scripts/script2.tcl \
scripts/script3.tcl \
]

It is vital that there is no space or other charactes after the \ before the newline.

Whenever a string is evaluated (in this case due to []), a newline means end of command-line, and the first word on the next line is treated as a new command. Escaping the newline prevents this, and lets us span a single command-line over several lines.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Thu Mar 25, 2010 1:38 am    Post subject: Reply with quote

well, know what? lol

i put a space after \ because of two reasons:

1. it seemed quite logic to me to escape a space char with \ so its really being treated as one

2. try to select that code of yours with your mouse and you'll notice that \[code\] puts a space after the \

plus, i made an important mistake, i didnt put a \ after the first line that contains "set scripts [list"

but wow .. im impressed because everything is working again and the mistakes were more of a minor matter. thx again for help Smile (cant say that often enough ^^)
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Mar 25, 2010 10:24 am    Post subject: Reply with quote

Ahh, one more converted Wink

I believe those spaces were due to your browser; I've seen some browsers adding them on the fly, while others (like mine) don't. Unfortunately, it becomes a somewhat complicated structure when you want to do it proper, yet have one item per line.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Thu Mar 25, 2010 1:09 pm    Post subject: Reply with quote

k-meleon here ^^
and yup, thats probably why then, weird things are happening on the internet lol
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
Goto page Previous  1, 2
Page 2 of 2

 
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