step 5. Mettere assieme
Line by line, here is the hello avatar script. Copy and paste this to a new script to see it color coded.
//Tutti gli scripts hanno bisogno di uno stato di default
default
{ //questa parentesi graffa rappresenta l'inizio dello stato
state_entry() // an event
// another curly bracket starts the body of the event
{
llSay(0, "Hello, Avatar!"); // a function inside the event
}
// closed curly bracked closes the state_entry event
touch_start(integer total_number) // another event inside default state
{
llSay(0, "Touched."); // a function between the brackets of the touch_start body
}
// end of touch start
}
// Code end
The instant you save your script, it enters default state, which in turns runs the "state_entry" event which in turn runs the funciton llSay() which makes the object talk.
After this the program waits idle in the default state until a new event is called.
Touching the box triggers the even "touch_start" which also makes the object speak.