Scripting nightmares

All these things are fairly easy to do – you got events for dealing with retrieving payments, giving objects to users, tracking counters, and timer events.

The trick is handling the “correct state”. All objects in Second Life are “always running” from the moment they’re first created. This means that if you drop them on the floor and pick it up again, they will be in the same state (although probably they’ve called a few events in between). If you give them to someone else, the state won’t change. Alas, if you give permissions for an object to animate your avatar, and give it to someone else, this doesn’t mean he/she gets permission to animate him/herself, too!

Finding out which state you’re in and resetting things properly IS painful! For instance, with the cigarette pack, if someone smokes 5 cigarettes and gives the pack to a friend, it should properly still have 15 inside, so if by any chance the pack gets reset, the counter shouldn’t go up to 20! On the other hand, when building the cigarette pack, testing it, and dropping it into the cigarette vending machine in the first place – the state has changed already! When someone pays for the pack, and is given a copy from the vending machine’s own inventory, what state is it in?

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