View Single Post
  #19  
Old 03-03-2010, 12:59 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I'll offer some things that I do when I need to debug something:

1. Be explicit, less chance for weird GS2 stuff to happen that way. What this means, prefix variables and function calls appropriately. Avoid ambiguity with variable names, make sure they don't conflict with existing things, etc. And don't do things like putting code outside of a function definition.

2. Echoes. I put echoes everywhere so I can tell where the script is executing, what parameters and objects exist at a certain point, etc. type() and objecttype() functions are useful for checking the state of objects.

3. Formatting. I'm anal about script formatting and adhere to strict methods of spacing and naming. Doing this means less chance of screwing up because you forgot a bracket or something. I also stick to using lower-case variable names in all but object names.
__________________
Reply With Quote