Custom-Made by Ahuva

I finally acted on one of my promises to myself. I made an object in SL and attached my very own script to it. Hmmmm. Okay – my conscience and I just had a battle and the “good angel” on my shoulder won. 🙂 It isn’t REALLY my very “own” script. 🙂 I had help. Oh please – it has been FOREVER since I wrote code. I looked at the LL scripting language and understood the concept. I remembered Boolean logic and if/else and vectors (arrays) and stuff like that. You know what I completely forgot??? Defining variables. Integer Side. Vector Color. I kept looking at the code samples thinking “what the heck is that all about?” So many, many thanks to B (yeah, the same B who nudged me to create a video way back in the beginning with my first prim). B is very good at explaining things in terms that are relevant to me. So B and I sat down together and wrote a script. But I’m getting ahead of myself.

First, I had to make an object. (Hint – look at my right wrist!!) That was my weekend assignment. Create something. What something? I wanted something I could use. Jewelry, I can ALWAYS use jewelry. 🙂 I figured most jewelry would be way beyond the scope of Build 1. But a bangle bracelet – that seemed eminently do-able. I thought at first I was going to take a sphere and drill a hole through it and shape it accordingly. I was quite disappointed to discover that one of the prims is a Torus . If you don’t know what a torus is and you are too lazy to click on the link, let me enlighten you. A torus looks like a bangle bracelet. 🙂 Bigger, fatter, but in essence, a bangle bracelet. So I rezzed a torus and shaped it to the right shape and size.

How do you rez a prim? By clicking on an environment hat allows you to rez a prim. So I was at NCI beach. I touched the sand and right-mouse clicked. A pie menu appeared and I clicked Create. That gave me the edit menu. Notice all the prims along the top. The 2nd row, 1st item is a torus. I clicked on that, touched the ground w/ my magic wand (top row, 2nd from the right) and there it was – my torus. It was way too big in all dimensions. So I sized it.

How do you size it? A lot like the way you size things in 2-dimensions. You grab a corner and stretch it out or in. Notice in this screen shot that you can click on Stretch to move into the mode to resize the item. So I played push-me pull-me with my torus until I had it the right shape and size.

Next I needed to change the angle. That meant that I would switch from Stretch to Rotate mode. Rotate mode gives you something that looks sphere-ish. LOL. Great technical description, right? I didn’t make a screen shot of this. You’ll have to trust me and use your imagination. Anyway, there are 3 colored lines in a sphere-ish relationship. You move the object along those lines to rotate it and change the angle of orientation. So my bracelet started out flat, but I rotated it to a vertical position. So I had a bracelet floating in space in front of me. I needed to get it on my wrist. That involves Position. Again a little confession. 🙂 I needed to send off an IM inworld to remember about Position. I’d been watching videos before I began creating and KNEW I’d seen how to move an object. I was too lazy to go back and watch the video again. It is definitely a good thing to have friends who build and script!

So when you want to position the object, you have 3 colored lines for orientation. I slid my bracelet along the red line (I think) until it was sitting very nicely on my wrist. 🙂 Tah-Dah!!! One bangle bracelet as desired!!

I still had my script from my Intro to SL class way back in July. (Remember my first prim? rotating, changing colors?) So I attached the changing-color automatically script to my bracelet and off I went to a Grace McDunnough concert, with my brand-new bracelet!!!! I was quite proud. 🙂

The next day I decided that I wanted to try to write my own script to change color. I googled SL scripting and found a site with all the functions and rules and stuff that you need to know to program. Even small examples. I drifted down the hall to get a refresher course in terminology from B. I’d have been shocked at how much I’d forgotten if I weren’t equally relieved at how much I remembered. 🙂

We started discussing how to structure a simple color-change script. And as is the way with us in our office, we went from talking to doing. We started typing out code and because we are both very nit-picky, we couldn’t stick with pseudo-code we started writing proper syntax. 🙂 Well OF COURSE I thought we may as well TRY it. After all, we had what looked to be perfectly good code. It should be tested. LOL. Just like that – all my years of support washed away. Sucked back into the mire of programming. So we added a new script. You can see in the screen shot that we had the original script there (but turned off). We also wrote a script that prompted you to click on a menu option to change the color (also turned off). But our final version was a script that changed the color when someone touched the bracelet. It looked like it should work, but it didn’t seem to work. This confused us. So I sent off some IM’s to inworld friends. They both agreed that the script should work. And indeed, when I tried it again, it did. B and I think we know what was wrong. LOL. It’s the kind of error that most of my early blogs mention. The kind of thing that is so well-known to the SL resident but not always intuitive to the newbie. 🙂 Suffice it to say, our script works, my bracelet changes color when I touch it and I am very very pleased.

We are now taking suggestions for Lesson 2!!!!