Jump to content

How can i create a HUD with moving parts that doesn't bug when buttons are clicked twice?


jabeds
 Share

Recommended Posts

I have recently created a HUD which when buttons on the HUD are clicked they move to another part of the screen. However do this I have used the following code.

llSetPos(llGetPos() - <1,0,0>);

stuff = llGetLocalPos();
stuff = llGetRootPosition();
llSetPos(llGetLocalPos() + (<2.5,0.0,0.0> * llGetLocalRot()));

The problem with this is that if someone clicks the button twice on accident, the HUD will repeat this action again meaning the object will move again and off the screen.

Is there anyway that i could add in steps so that if the button is clicked twice it wont move a second time. Or if there a better function that i should be using.

ps. I can't just use LLSetPos because these are cild prims not the route prim.

Link to comment
Share on other sites


jabeds wrote:

 

Is there anyway that i could add in steps so that if the button is clicked twice it wont move a second time. Or if there a better function that i should be using.

I don't think you're looking for a function, but a variable or detection method that controls the process flow of your script.

E.g.,

integer bIHaveBeenTriggered = FALSE;default{    touch_start(integer num_det)    {        if(bIHaveBeenTriggered == TRUE)        {             llOwnerSay("I've already been triggered.");        }        else        {             llSetPos(llGetLocalPos() + (<2.5,0.0,0.0> * llGetLocalRot())); //Copied from your script             bIHaveBeenTriggered = TRUE;        }    }}

 You could compare against llGetLocalPos to see whether or not the move has taken place, if appropriate. This would save you declaring a variable, but is likely to have a similar overhead.

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...