Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Adding the switch() statement to scripting.

Goodwill Epoch
Admiral of Kazenojin
Join date: 20 May 2003
Posts: 121
05-22-2003 14:29
One aspect that C and J coding has that LSL doesn't seem to have is the switch() statement. i.e...
CODE
switch (blah_in) 
{
case "hello":
blah_out = "Hi, how are you?";
break;
case "bye":
blah_out = "Thanks for stopping by!";
break;
default:
blah_out = "I'm sorry, I did not understand that";
}
Just working on some simple code, this statement would greatly help in creating some more flexible and simple programs that a large multi-tiered IF ELSE block would complicate. This would also be useful if the switch() statement only supported integers.

I would also like to see some way to store data within an object (for example, inside a text-file or other data file that could be contained in the objects inventory).

Thanks :)
_____________________
http://www.narfy.com
Ope Rand
Alien
Join date: 14 Mar 2003
Posts: 352
05-22-2003 15:10
i agree this would be useful. for one thing inside a control event. just a nice way to clean up code :)

Goodwill, theres llGetNotecardLine() so you could get data from a notecard in the objects inventory, but theres no way to write to it tho.
_____________________
-OpeRand