Scripting nightmares

Wow. I thought this would be easy. LSL (Linden Scripting Language) looks like C++, Java or Javascript, so I thought I would give a go at it. Actually, just like Java, it’s an interpreted language, but it gets precompiled before it goes into the magic stores at Linden’s.

The hard part at scripting is getting the state machine working. For those of you who have never programmed on a state-based system before (programming for Windows, the Macintosh, or KDE/Gnome works in the same way) and just have looked at the several scripts, it looks easy, doesn’t it? After all, everything you do puts the object in a “state” – either touched, or worn, or listening to voice commands on the chat line, or getting permissions from the user, etc. So it should be just an easy matter of defining the right responses to each state, right?

Wrong. I thought the same.

My first example was the Cigarette Vending Machine here. You can get cigarette packs from it, each one costs L$3, and gets you 20 cigarettes in a pack. The pack will happily give you those 20 cigarettes, and then will silently refuse to give you more (you got to buy a new pack then). Each cigarette lasts around 6 minutes or so.

| | | Next → |
%d bloggers like this: