Monday 11 February 2008

Scripting


Tutorial 3 Material


I have partially done the tutorial before the Bsc students have the actual tutorial as Judy was ill, and I had happened to be in the Msc Tutorial class on the previous Friday morning, which gave me a little bit more time to explore the scripting side SL. It was fun, at first I thought I won't be able to do any scripting at all, but after Judy said everyone can be a scripter, then I stopped worrying. Judy gave us a lot of hints on the tutorial worksheet, which gave me a lot of idea what functions should we be looking at using in our codes.

I have spent a little bit of time working through how to make an object talk, and I found that the scripting language is actually quite similar to the other ones that we have been using. I actually find that making things to interact with avatars had motivated me to code something. I have found that I have understand how to code a lot better than writing programs to say 'Hello world' :).

"Stonelike Greeter" & "Stonelike Bouncer"

As mentioned on the last post, I had to create something that will responds to the avatar who touches it. Instead of just creating a box to practice scripting, I have actually use the opportunity to practice my building skills as well, as I think that a box sitting on the island isn't that attractive, so I have created my "Stonelike Greeter" and my "Stonelike Bouncer" to output messages with their name in the middle of the sentence as a response, for coding details of my "Stonelike"-selection, please look at my last post. The yellow one is a cheeky bouncer, I made it just for fun.


My "Stone-like" selection and my talking art-piece

Talking art piece

I have no idea what to do when I have to practice coding something that will talk/whisper random message to the avatar who touches it, so I have created this art-like ornament. It will random pick a number using the llFrand(float max) function which will generate a random number according to the parameter you have provided. At first I didn't have a clue how to use the randomised number, but after a couple minutes I have got a solution, using if-then-else to check conditions. After I have created it, it works! I felt that I've actually achieved something :) I also had a second thought after I've created it, I think a while loop will also work :p

Something that I found

I was going to name all the sentences in my "Talking art piece" to "1", "2"... with all these numerals, but Judy told me not to, as it may upset the compiler, I am glad that I have done this tutorial sheet in the lab, there is always someone to help :) after I thought about it, I think she was right, because when I write my if-then-else statement, something like this will appear in my script :

if (random == 0) {
llWhisper(0, 0),

Which this will confuse the compiler if I meant 0 as some sort of size or the number I would like to show and other errors it may occur... but with the name zero, it will always be representing the pointer to a string. I am not very good at describing things about coding, if I confused anyone here, please excuse my lanugage problem here.

Fun Time

I nearly forgot to upload this lovely picture that I have taken while I was in a great costume :) I was a BANANA.... :) I've found this avatar set sometime ago and I have never really tried it on, once I've tried it, I can't take it off again as it's so hilarious. I did take it off at the end, coz it's taking too much space on the screen, I can't really see where I am going :) If you know me on SL, come and grab me or IM me, I will give you a copy of it :)

This is me in the BANANA costume ;p