Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

New Tutorial on Configuring Scripts Using Notecards

Squeebee Wakawaka
Newbie Savant
Join date: 22 Feb 2006
Posts: 28
09-25-2007 14:26
Hi All;

I'd been asked a few times lately about how I configure scripts using notecards and decided that a tutorial was in order.

I've written up the process I use at:

http://www.wakatech.com/articles/lsl-scripting-basics/configuring-lsl-scripts-using-a-notecard/

Hopefully it helps someone looking to do the same. Feedback is certainly welcome.
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
09-26-2007 10:41
Great tutorial Sqeebee. A few minor comments:

• Where in the visible code it says "&" replace with & (& is the HTML element for &;).
• Use different names for global variables, I always start mine with a g (for global) like gQueryId. That way, something like "queryid == QueryID" won't be as confusing. Personally I'd name the global Query ID something like gNotecardQueryId.
• VOLUME and SPEED aren't constants, so don't make them all uppercase. I would use gVolume and gSpeed instead. In my definition a constant NEVER changes anywhere in the code. Volume and speed are changed if the configuration notecard exists.
• If you cast the name from the config file to lower- or uppercase, then check for a lower- or uppercase value (ofcourse, both lower- or both uppercase), the notecard isn't case sensitive anymore.

Lyn
Squeebee Wakawaka
Newbie Savant
Join date: 22 Feb 2006
Posts: 28
09-26-2007 10:54
From: Lyn Mimistrobell
Great tutorial Sqeebee. A few minor comments:

• Where in the visible code it says "&" replace with & (& is the HTML element for &;).


Silly Wordpress went and messed with my code, thanks for the heads-up!

From: someone

• Use different names for global variables, I always start mine with a g (for global) like gQueryId. That way, something like "queryid == QueryID" won't be as confusing. Personally I'd name the global Query ID something like gNotecardQueryId.


I've never been one for prefixes since back when I was a rebellious VB developer but I'll think about that.

From: someone
• VOLUME and SPEED aren't constants, so don't make them all uppercase. I would use gVolume and gSpeed instead. In my definition a constant NEVER changes anywhere in the code. Volume and speed are changed if the configuration notecard exists.


True, but I like to mark anything that is set only once and never modified again also with constant formatting since it's constant enough for me ;)

From: someone

• If you cast the name from the config file to lower- or uppercase, then check for a lower- or uppercase value (ofcourse, both lower- or both uppercase), the notecard isn't case sensitive anymore.


That was my intent.

Thanks for the feedback, I know I buck style conventions a little here and there but I stick to my vices ;)