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());
}
}
}