Now im gettting to grips with the language, its relatively simple (compared to c++) but can be very annoying when the syntax goes wrong, For this week so far i have only attempted two of the exercises so far, still trying to find some time around other areas of my time to get to that and the blogging - not good at the moment.
The first example of script that was needed was an object which told the time and said whether it was morning, afternoon or evening to the avatar, as the second life day is only four hours this would happen quite often! :D
I chose a cylinder for this object, purely for a difference. Below is the script working in Second Life:
The code for this is shown below:
default
{
touch_start(integer total_number)
{
float tod = llGetTimeOfDay( );
llOwnerSay("Time since last region restart or SL midnight (based on SL 4 hour day):");
integer hours = ((integer)tod / 3600) ;
integer minutes = ((integer)tod / 60) - (hours * 60);
llOwnerSay((string) hours+"h "+(string) minutes+"m");
if (hours < 2 )
llOwnerSay("Good Morning");
else if (hours < 3 )
llOwnerSay("Good Afternoon");
else if (hours < 4 )
llOwnerSay("Good Evening");
}
}
The other of the two tasks that i have finished is a collision detection model which tells me who has colided with the object and how fast they were moving. The script was pretty easy to find and worked pretty well. Below is the script in Second Life:
And below is the script for this object:
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
collision_start(integer total_number)
{
llOwnerSay(llDetectedName(0) +" has collided with me!");
llOwnerSay(llDetectedName(0) +" was traveling at: "+(string)llVecMag (llDetectedVel(0))+"m/s");
}
}
It converts the speed into metres per second which is easier than mph or another measurement. Will be interesting to see what we do in week 3, and maybe i will get a blog out on time, you never know it might happen!


Good work, well described with suitable evidence. In later weeks just post an account of one of the exercises as they will be more extensive.
ReplyDeleteHmmm, so far so good but you seem to be falling a bit behind. You should post a brief description of your idea for the final assessment.
ReplyDelete