Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Link-Set detection

Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
10-10-2008 13:41
Just playing with old scripts and I'm trying to get the coded door script to work, everything complies except the script that tells me which button number its Link-Set number is.

Quote:
"Because of the nature of link-sets and whatnot, you'll need to edit this script to use it. You need to figure out which link number corresponds to which button. You can do this by adding a line like this to the touch_start() event, then taking it out once you've got it figured out:

llSay(0, "You touched link number " + (string)llDetectedLink(0));"

so I have this script in the button but it doesn't compile:

CODE

default

{
state_entry()
{

llSay(0, "Hello, Avatar!");
}

touch_start(integer total_number)
{
llSay(0, "You touched link number" + (string)llDetectedLink(0));
}

}


the error is ";(11, 69) : ERROR : Name not defined within scope" cursor is just after the last 0 (zero) can anyone tell me why please.
Dytska Vieria
+/- .00004™
Join date: 13 Dec 2006
Posts: 768
10-10-2008 13:47
It needs to be llDetectedLinkNumber(). llDetectedLink() is not a LSL function :)
_____________________
+/- 0.00004
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
10-10-2008 13:49
ahhh ok I have discovered I should have this in the main script, I think?

but I'm crap at this, so I get an error on this too:

CODE

default
{
state_entry()
{
queue1 = 0;
queue2 = 0;
queue3 = 0;
doClose();
}

touch_start(integer total_number)
{
llSay(0, "You touched link number" + (string)llDetectedLinkNumber(0));
}

// figure out which like was touched then translate that
// to a button value.

integer num = llList2Integer(link_trans, llDetectedLinkNumber(0));
if (num != 0 && !open)
{
llTriggerSound("click", 0.5);
enqueue(num);
checkQueue();
}
}


Error occurs just before the word integer, so i am guessing something like an { is missing?

Edit: ok changed it to llDetectedLinkNumber but still have the same error.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
10-10-2008 14:06
You need to put it inside the touch_start() event. You have it outside any event, and that gives the compiler collywobbles.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
10-10-2008 15:03
thanks, fumbled about and it works.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-11-2008 11:15
You can also use llGetLinkName() and name each prim appropriately. So...

CODE

default
{
touch_start(integer nDetected)
{
integer primNum = llDetectedLinkNumber(0);
llSay(0, "You touched link number "+(string)primNum+" with name '"+llGetLinkName(primNum)+"'");
}
}


That might save you from editing the script for each new object and manually setting up a map of prim number to function.