Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to launch a script in a linked prim?

Seven Okelli
last days of pompeii
Join date: 4 Dec 2008
Posts: 2,300
07-15-2009 18:56
I'm building a house, and the the scupty stairs need to be phantom, which means they can't be linked. While I'm building, I have the stairs both solid and linked so I can keep them in place.

I wrote the following script thinking that I could put it inside the sculpty prim. I figured it would tell the user to click on the stairs to fix them. Then, when the user clicks on the stairs, the script would unlink the prim, set it to phantom, and then the script would delete itself.

The problem is, I can't trigger the script to run.

Does anyone have any suggestions?

integer CHANNEL = 42;

default
{
// --- on startup, tell them they can fix the stairs ---

state_entry()
{
llSay(0,"When the house is in its final location, Click on the
stairs to make them usable.";);

llListen(CHANNEL, "", llGetOwner(), "";);
}

// --- on click, ask for permission to work ---

touch_start (integer total_number)
{
// you need permission to unlink items

llDialog(llGetOwner(),
"You should not fix the stairs until the house position is
final.\n\nIs the house in its final position?",
["Yes","No"],CHANNEL):
}


listen(integer channel, string name, key id, string msg)
{
if (key == llGetOwner())
{
llRequestPermissions(key, PERMISSION_CHANGE_LINKS)
}

}

// --- if permission is given, unlink stairs and make them phantom

run_time_permissions(integer perm)
{
if (perm & PERMISSION_CHANGE_LINKS)
{
llSay(0,"Unlinking stairs from house.";)
llBreakLink(llGetLinkNumber())
llSay(0,"Setting stairs to phantom.";)
llSetPrimitiveParams([PRIM_PHANTOM, TRUE])
llSay(0, "Stairs should now work normally.";)

// delete this script

llRemoveInventory(llGetScriptName());
}
}
}
_____________________
:
: I met most of the people I know in Second Life through these forums.
: I learned most of what I know of Second Life through these forums.
: When I couldn't get inworld, these forums were the next best thing.
: And sometimes these forums WERE the best thing.
:
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-15-2009 19:03
simple solution... change state_entry to on_rez, then set it active... it won't fire immediately(no incomming on_rez triggered, but it will after the customer rezzes it.

and if you use a box rezzor you don't need a script at all, just leave it unlinked.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -