Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help with on/off for hud

LaZy Hulka
Registered User
Join date: 11 Apr 2006
Posts: 32
08-06-2006 20:50
Hello I am make a hud that alones you to use super jump. I want it so you can trun it on or off. There first script works well. I just need help with the second script I don't know how to stop it from give you the super jump force

Here First script the trun on one
CODE

key avatar;
default
{
touch_start(integer total_number)
{
llOwnerSay("Super Jump On");
vector force = <0,0, llGetMass() * 6.2>;
llSetForce(force, TRUE);
if(avatar==NULL_KEY)
{
llSetForce(<0,0,0>,TRUE);
}
}
}



Here the one I need help with the trun off one
CODE

key avatar;
default
{
touch_start(integer total_number)
{
llOwnerSay("Super Jump Off");
vector force = <0,0, llGetMass() * 0.0>;
llSetForce(force, FALSE);
if(avatar==NULL_KEY)
{
llSetForce(<0,0,0>,FALSE);
}
}
}


Thank you for your help and posting :)
_____________________
USMC Time to kick ass and take names later. Show No Mercy

Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
08-07-2006 06:12
Here is a single toggle on/off. Not sure if this will cover you needs.

CODE

integer status;

default
{
on_rez(integer parm)
{
status = FALSE;
llSetForce(ZERO_VECTOR, TRUE);
}
touch_start(integer total_number)
{
if (!status)
{
llOwnerSay("Super Jump On");
status = TRUE;
llSetForce(<0,0, llGetMass() * 6.2>, TRUE);
}
else
{
llOwnerSay("Super Jump Off");
status = FALSE;
llSetForce(ZERO_VECTOR, TRUE);
}
}
}
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
08-07-2006 16:31
Here's a version using states:
CODE

default
{
touch_start(integer total_number)
{
state Super_Jump;
}
}

state Super_Jump
{
state_entry ()
{
llOwnerSay("Super Jump on.");
llSetForce(<0,0, llGetMass() * 6.2>, TRUE);
}
touch_start(integer total_number)
{
state default;
}
state_exit ()
{
llOwnerSay("Super Jump off.");
llSetForce(ZERO_VECTOR, TRUE);
}
}
LaZy Hulka
Registered User
Join date: 11 Apr 2006
Posts: 32
08-07-2006 18:46
Sweet Thanks, both of you for helping me out. Also thanks for your time and reading and replying my post :)
_____________________
USMC Time to kick ass and take names later. Show No Mercy