Jump to content

Detecting Double Click Teleporting


Ares Halostar
 Share

You are about to reply to a thread that has been inactive for 4139 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

We have a game that involves a lot of movement in an arena, but it is ruined by people cheating by double click teleporting to cover distances quickly.

I am messing with a basic script that will detect when a prim is clicked twice in succession, but I am having problems with the touch event possibly not detecting fast enough, or my script logic is wrong.  Can someone please look at my script and tell me where I am going wrong.

integer Increment = 0;
default
{
    state_entry()
    {
        Increment = 0;
    }
    touch_start(integer total_number)
    {
        
        Increment +=1;
        if(Increment>=2)
        {
            llSetTimerEvent(0.0);
            llSay(0,"Touched Twice");
            Increment = 0;
        }
    }
    touch_end(integer total_number2)
    {
        llSetTimerEvent(1.0);
        if(Increment>=2)
        {
            llSetTimerEvent(0.0);
            Increment = 0;
        }
    }
    timer()
    {
        llSetTimerEvent(0.0);
        llSay(0,"Timer is working.  Increment = "+(string)Increment);
        Increment = 0;
    }    
}

 

Link to comment
Share on other sites

touch_end( integer vIntTch ){    if (llGetTime() < 0.5){        //-- double click    }else{         llResetTime();    }}

 please note that it'll only work on prims... if there's something that the av wears it's more effective to monitor the avs velocity between points.

Link to comment
Share on other sites

I tried your script, but it will detect every touch, and not just two touches.  Unfortunately we can't have the people playing the game to wear a prim that would detect speed/position.. that would have been a nicer option, but was deemed unworkable.  Just a simple script to detect when a prim is touched twice in succession, then reset it's counter/timer.

Link to comment
Share on other sites

Sorry to be a pain Void and thank you for your help, but I tried it both ways, with greater than or less than.  One way gives a result with one or two clicks.. the last suggestion gives no results.

default{    touch_end( integer vIntTch )    {        if (llGetTime() < 0.5)        {            llSay(0,"Double Clicked");        }        else        {            llResetTime();        }    }}

 

Link to comment
Share on other sites

hmmm looks like the viewer is intercepting the second click when the doubleclick-teleport option is engaged... the posted code works fine if it's unchecked....

teleport routing and/or position detection of individual av's are going to be the only available options.

Link to comment
Share on other sites

Besides teleporting, one could cheat using an attached physical booster script.  Unless you're preventing participants from wearing any scripts, it may be safer to go with position-tracking rather than rely on parcel teleport routing (although that may be a fine thing to do for other reasons anyway).

Just a guess, but my hunch is that you'd get less lag from repeated llGetObjectDetails() over a roster of "enrolled" participants than you'd get from a sensor, and that calculating speed from distance over time would be more reliable than using instantaneous OBJECT_VELOCITY.

Link to comment
Share on other sites

Thanks for all your replies.  And yes Void, I think you are right.  To Peter, the game is hosted on a built Arena in the air.  I thought that if I could count two quick left clicks on the floor of the arena, I could detect double click teleporting, but looks like the viewer is intercepting the second click.  

Also, setting a landing point was discussed, but most users of the sim wanted to use double click teleporting in everyday use, so we won't be setting a landing point unfortunately.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4139 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...