sábado, 20 de junho de 2009

SCRIPTS

AÇÃO: TOQUE
EFEITO: GERA MENSAGEM

default

{
state_entry()
{
llSay(0, "!");
}

touch_start(integer total_number)
{
llSay(0, "Touched.");
}
}


AÇÃO: TOQUE
EFEITO: LIGA E DESLIGA

default //default state is mandatory
{
state_entry() // runs each time the state is entered
{
llSay(0, "turning on!"); //object speaks!
llSetColor(<1.0, 1.0, 1.0>, ALL_SIDES); // sets all sides to most bright
// note the semicolons at the end of each instruction (do not put them at the end of if statements)
}

touch_start(integer total_number) // another event with only one function inside
{
state off; // sets the script to a new "state" and starts running "state off"
}
} // this curly bracket ends the body of the default state.

state off // a second state besides "default"
{
state_entry() // this is run as soon as the state is entered
{
llSay(0, "turning off!");
llSetColor(<0.0, 0.0, 0.0>, ALL_SIDES); // sets all sides as dark as possible
}

touch_start(integer total_number)
{
state default;
}
}



AÇÃO: TOQUE
EFEITO: OBJETO INVISIVEL




integer hidden = FALSE; // Stores whether the object is visible

default
{
state_entry()
{
llSitTarget(<0,0,1>,<0,0,0,1>); // Set the target one meter above the ground
llSetSitText("Pose!");
}

changed(integer change)
{
if(change & CHANGED_LINK) // If someone has sat on, or "linked," to this prim...
{
key avataronsittarget = llAvatarOnSitTarget();
if( avataronsittarget != NULL_KEY ) //Someone is sitting on the object
{
// Before animating, first check if we have permission to do so:
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget) {
// If we do, we can animate:
llStopAnimation("sit");
llStartAnimation("dance1");
} else {
// If we dont, ask for them:
llRequestPermissions(avataronsittarget, PERMISSION_TRIGGER_ANIMATION);
// We'll animate in the run_time_permissions event, which is triggered
// When the user accepts or declines the permissions request.
}
}
}
}

run_time_permissions(integer perm)
{
if(perm)
{
// Place the code here!
llStopAnimation("sit");
llStartAnimation("dance1");
}
}

touch_start(integer total_number)
{
if(hidden)
{
hidden = FALSE;
llSetLinkAlpha(LINK_SET,1,ALL_SIDES);
}
else
{
hidden = TRUE;
llSetLinkAlpha(LINK_SET,0,ALL_SIDES);
}
}
}

Nenhum comentário:

Postar um comentário