Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with llDetectedGrab

Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
12-19-2007 14:24
Hey everyone,
I've been screwing around with llDetectedGrab and I'd though I'd see if I could make it so that if I dragged the mouse up the object would say up, and if I dragged it down the object would say down. It isn't going very well :(. Anyways, if someone could look at the code and fix it or tell me how to fix it, that'd be great! (I find an error at the if statements.)

CODE

string up = "<0,1,0>";
string down = "<0,-1,0>";


default
{
touch(integer num_detected)
{
if(up > llDetectedGrab(0))
{
llSay(0, "Up");
}
else if(down > llDetectedGrab(0))
{
llSay(0, "Down");
}
}
}
_____________________
-Smithy
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-19-2007 15:40
Try this and you will be able to see what is going on:

CODE

default
{
touch(integer total_number)
{
llOwnerSay((string)llDetectedGrab(0));
}
}


Having said that......... llDetectedGrab's uses are really, really limited. In nearly every case you can script something much more reliable and sim freindly by not using it. Probably find it will be better to just use two buttons; up & down and use llDetectedLinkNumber with just one script.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
12-19-2007 15:48
Perhaps this workaround posted today by coincidence, may prove helpful. Seems llDetectedGrab has a bug:

/54/d0/230710/1.html
_____________________
Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
12-19-2007 17:56
Thanks for the code snippet there Jesse, but I'm still stuck on my original script. I'll try to get it to work tonight, but in the meantime, can someone point me in the right direction on how to fix it?
_____________________
-Smithy
Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
12-20-2007 03:07
Thanks for the code snippet there Jesse, but I'm still stuck on my original script. I'll try to get it to work tonight, but in the meantime, can someone point me in the right direction on how to fix it?
_____________________
-Smithy
Smithy Zeno
ownes 9 pet cacti
Join date: 3 Aug 2006
Posts: 52
12-20-2007 13:18
I looked at the example and I saw that llDetectedGrab returns vectors that are below decimals. I change it (the vectors at the top) to .1.
CODE

vector up = <0,.1,0>;
vector down = <0,-.1,0>;

default
{
touch(integer num_detected)
{
if(up > llDetectedGrab(0))
{
llSay(0, "Up");
}
else if(down > llDetectedGrab(0))
{
llSay(0, "Down");
}
}
}


But I get an error at the 'if' and the 'else if' statements if I leave it as a greater than or less than. But if I change it to an equal sign, its fine. Anyone have a solution to this?
_____________________
-Smithy