Thursday, October 11, 2007

Bucket notes

This is for me to keep track of the way in which I developed the bucket code. This isn't really of interest to anyone else, and mostly is just so for the future I don't waste as much time trying to do things that can't be done (although, with Mono someday maybe, ha!, soon, some of this may be obsolete before I try anything like this again- although most of the problem was with the permissions system). Also, it serves as some insight into how I feature creep, because, well, I have a tendency to.

At first inception the bucket was to: hand out items to anyone that touched it, have an arm animation for holding it standing, and have an animation to hold it out to say Trick or Treat. The sound was pretty much included as something I wanted from the beginning, even though I tend to avoid sound, and in fact usually have my computer sound off (a habit I got into long ago when I had a particular roommate, and after that year all the burps and whistles annoyed me since I'd become used to not hearing them).

I decided I wanted the items handed out to be no copy. This serves a few purposes- one, it means that once the bucket is not present, you're stuck with the few items you have, and you have to give away items, not just share them. It's an analog world recreation, since with digital replication it makes far less sense. However, it has the advantage to making it a game as to who gets what ("Awww, I wanted those horns!" "I'll trade you for that hat!"), as well as reducing inventory clutter a little- giving away your candy means you don't now have the copy. Again a having-cake-and-eating-it situation makes more sense in digital, this was to suggest real world conditions.

Now, with the way SL deals with permissions, this means that only I can easily do the system this way. Giving the distributor out to people means that I really need to be able to set a second generation of permissions (items in bucket- copy, taken out of bucket- no copy). That simply isn't possible with how the system is currently structured, there is no way to program more restrictive permissions beyond setting it in the properties tab for one next owner. Telling people to set all the copies in the bucket no copy by hand? Neither a solution that would happen, nor a solution that has any appeal for, well, anyone.

This gave rise to no-copy/transfer items in the bucket. Contents are effectively unlimited (apparently), so I could cram multiple copies of everything into the bucket, so it would take a very long time to run out (there are quite a few distinct items [over 40 if I recall correctly, although a number are just hue shift candies], and I'd gotten up to 20 copies of each and the system was lagging on loading the contents terribly...and really, that's going to last just about anyone a good long time). If it's going to run needs to actually tell you it's running out. So, I coded the attachment to have the "contents" of the bucket slowly sink, then start disappearing (it got quite spectacularly complex as I was doing a check to see if there were any lollies or apples left to take away the lolly and the apple when they ran out, as well as each individual candy of the...34, I think it is, to disappear one by one at the end- and that made for massive headaches and almost impossible testing, as the candy doesn't run out for me, so it was touch to load the script, open and delete item, touch again, for 40+ times. The very last "pull" was to be a unique item to each bucket, the worm "bracelet", as the worm would be the very last thing to disappear. The bucket would then appear empty, and touches would now turn the lights on and off instead- the animations and "Trick or Treat!" would still happen as usual).

So I coded all of that up, massive headache that it was, since each candy had to have a distinct script- llGetObjectName does not have an associated function for getting the names of child prims to make life easier, so it was pretty miserable.

Then I finally talked Max into making an appearance so I could make sure it worked...and every touch regaled me with a script error. @$#%&*! Now, this could have been avoided if I actually did read through all of the text on the wiki ("No-copy objects can not be given from attachments."), but, well, I tend to skim things a lot so I missed that crucial point of information.

Which meant that the objects given out had to be copy/transfer. Period. Otherwise you wouldn't be able to give things out to anyone (and copy/no transfer was never something I wanted for the contents, they should be shared). All of the headache over the lowering candy level and checking for the last apples and lollies, and candy disappearing one by one at the needed to be thrown out. None of it would work, unless I decided to delete the contents as they were being given out, which would just be mean, really. It made sense while items would be no copy, but once they are? It ceases to make sense, since they are infinite outside of the bucket, they ought to be infinite inside it as well.

Which all meant that it could have been finished at least a week ago, maybe 2, if I would have just gotten down to doing the recording sooner. (After scouring the net for a good royalty free "Trick or Treat!" sound from a gang of children, I finally gave up, and just recorded myself saying it a few times, pitch shifted some, and layered it all. I think it actually came out rather well, even if it is just me masquerading as a gang of children, and not actual kids. Thankfully I did it before my voice got quite so wrecked by this cold, as well.)

I did end up adding a mini AO as well so when sitting (or crouching), the arm is not held out straight, but instead holds the bucket up in your lap (and around that general area, mostly it tends to be inside your leg a lot, but that's partly to keep wrists from being bent at horribly ugly pointy angles).

No comments: