Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDetectLinkNumber - Stuck Touch on Prim?

Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
01-26-2010 02:07
Yesterday I incorporated llDetectLinkNumber into the main script of my HOLO vendor to replace the "Forward", "Back", and N/C Giver button scripts. I completed this for 14 vendors.

I logged on a little whiles ago and found one of the vendors continuously forwarding thru HOLO objects without anyone touching the forward button. I eventually had to delete the vendor and rez a new one.

I use the basic touch() event and was wondering if I need to incorporate touch start() and/or touch end() in some fashion? One vendor continuously cycling was bad enough... I'd hate to have 14 of them doing this... lol

Here's a copy of the touch() event I'm using. Variables are defined globally.

All help greatly appreciated. :-)

CODE


touch( integer n)
{
giver = llDetectedKey(0);
if (giver != NULL_KEY)
{
if ((llGetOwner () == llDetectedKey (0)) && (llDetectedLinkNumber(0) == 2))
{
if (storelisten == 0)
{
storelisten = llListen(0,"",ownerkey,"");
llSay(0,"Listening to commands.");
}
else
{
llListenRemove(storelisten);
storelisten = 0;
llSay(0,"Deaf to commands.");
}
}

// Forward Button

else if(llDetectedLinkNumber(0) == 3)
{
selected++;
if (selected > numberitems)
selected = selected - numberitems;
llSetLinkTexture(2,llList2String(currentitemlist, (selected - 1) )+"PIC",2);
price = (integer)llList2String(currentpricelist,(selected - 1));
llMessageLinked(LINK_ALL_OTHERS, price, "updatePrice", "");
llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
doRezNow();
}

// Back Button

else if(llDetectedLinkNumber(0) == 7)
{
selected = selected - 1;
if (selected < 1)
selected = selected + numberitems;
llSetLinkTexture(2,llList2String(currentitemlist, (selected - 1) )+"PIC",2);
price = (integer)llList2String(currentpricelist,(selected - 1));
llMessageLinked(LINK_ALL_OTHERS, price, "updatePrice", "");
llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
doRezNow();
}

// Notecard Giver

else if(llDetectedLinkNumber(0) == 5)
{
llGiveInventory(giver, llList2String(currentnotecardlist, (selected - 1)));
}


}

_____________________
There's no place like home... click
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
01-26-2010 02:19
The touch event does keep firing repeatedly all the time someone is clicking on the thing but it should stop when they're not! Presumably either someone clicked and then crased and SL couldn't work it out or someone was still clicking it, just to annoy you, maybe they were out of sight.

I'd use touch_start or touch_end because they are only triggered once per touch. Even when working properly people could inadvertently touch 'too long' if you just use touch on its own.

Of the two touch_end is safer because of the known issue when changing state within a touch_start. I'm in the habit of using touch_end even when I don't intend to change state, just to be on the safe side.
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
01-26-2010 02:39
From: Indeterminate Schism
The touch event does keep firing repeatedly all the time someone is clicking on the thing but it should stop when they're not! Presumably either someone clicked and then crased and SL couldn't work it out or someone was still clicking it, just to annoy you, maybe they were out of sight.

I'd use touch_start or touch_end because they are only triggered once per touch. Even when working properly people could inadvertently touch 'too long' if you just use touch on its own.

Of the two touch_end is safer because of the known issue when changing state within a touch_start. I'm in the habit of using touch_end even when I don't intend to change state, just to be on the safe side.


Do I need to call out a touch start() to use a touch end()?

:-)
_____________________
There's no place like home... click
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
01-26-2010 02:48
No, touch_start, touch, and touch_end are 3 separate event handlers.

touch_start is triggered when you press the mouse key. touch is triggered as long as you hold down the mouse key and touch_end is triggered when you release the mouse key.

For the same reason as Indeterminate mention, I also use touch_end almost exclusively:)
_____________________
From Studio Dora
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
01-26-2010 02:54
From: Dora Gustafson
No, touch_start, touch, and touch_end are 3 separate event handlers.

touch_start is triggered when you press the mouse key. touch is triggered as long as you hold down the mouse key and touch_end is triggered when you release the mouse key.

For the same reason as Indeterminate mention, I also use touch_end almost exclusively:)


Wonderful! I will go ahead and switch to touch end().

I appreciate the help Indeterminate and Dora... thanx! :-)
_____________________
There's no place like home... click