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.

Testing script before starting eggdrop ?

Help for those learning Tcl or writing their own scripts.
Post Reply
D
Danko
Voice
Posts: 18
Joined: Thu Mar 09, 2006 1:07 pm

Testing script before starting eggdrop ?

Post by Danko »

Is there any way to test a script (that it wont crash the egg etc) ?

Atm I'm editing script, rehashing eggdrop, editing again, etc etc..
This works, but I feel its a waste of time, re-starting the eggdrop every time it crash...... huh..?
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Enclose the code within catch.

Code: Select all

catch {
 #code here
}
and use .set errorInfo to see errors.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

I personally use this little script to load my scripts:

Code: Select all

#	#	#	#	#	#	#	#	#
# .loadtcl
#

bind dcc n loadtcl loadtcl

proc loadtcl {hand idx args} {
	if {$args == {{}}} {
		set args $::lasttclloaded
	} else {
		set ::lasttclloaded $args
	}
	uplevel #0 [list source scripts/$args.tcl]
	return 1
}
This will simply "rehash" a single script, very fast and very usefull imho.
ex.:
If you want to rehash 'scripts/google.tcl' just type:
.loadtcl google

If you get something like '[18:28:57] #De_Kus# loadtcl google' loading was successfull, else you should see the TCL error (if not disabled on console).
ex.:
.loadtcl idonotexist
[18:38:42] Tcl error [loadtcl]: couldn't read file "scripts/idonotexist.tcl": no such file or directory
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...
User avatar
sKy
Op
Posts: 194
Joined: Thu Apr 14, 2005 5:58 pm
Location: Germany

Post by sKy »

There is no need to let the bot crash every time. :)
Use the 'saved source' command, errorInfo and backtraces. Should be enugh help. Enjoy. =)

http://forum.egghelp.org/viewtopic.php?t=10291
socketapi | Code less, create more.
Post Reply