Hi,
I have been working on a script and have run into some issues with it.
The script is to be placed in an item (a texture selector that looks like part of a control panel) on the wall of a house. When a person clicks/touches the item they are asked for permission to attach a HUD, if accepted, the Hud will appear on the screen center and temporarily stay on screen until a detach button is clicked. The HUD will not be saved to the user's Inventory, which saves on clutter.
Within the switch (object) will be the Texture HUD that will be placed on the screen.
So far I have this working, but it places the touched (switch) itself on the screen as the HUD, not the content which is the actual HUD. Also, when the (switch) is touched and placed on the screen, it disappears and is deleted.
In addition to that not properly working I get this error llGiveInventory: Can't parse destination key" As you can see from the below script I have some items with statements. Lines 24-32 is where I am testing the llGiveInventory.
Again, in short, all this should do is be a clickable/touched object(switch) on a wall, ask for permission to attach a HUD, and if accepted then leave the (switch) on the wall and place the content of the (switch) being the texture hud on the screen as a HUD.
Can someone tell me what is missing or not right in my script or is this something that will not work? Sorry if I may have sounded repetitive in my explanation.
Thank You
string objectName = "TextureHUD"; // Change name if different
default
{
state_entry()
{
llListen(0, "", NULL_KEY, "");
}
touch_start(integer n)
{
llRequestPermissions( llDetectedKey(0), PERMISSION_ATTACH ); // Pop-up Asking usr permission to attach.
}
run_time_permissions( integer UserPermissions )
{
if( UserPermissions & PERMISSION_ATTACH )
{
// +++++++++++++++++++++++++++++ Added Test +++++++++++++++++++++++++++++++++++++++++++
llGiveInventory(llDetectedKey(0), objectName); // Give object content
llAttachToAvatarTemp( ATTACH_HUD_CENTER_2); // placement of HUD. y and z position needed?
}
// +++++++++++++++++++++++++++++ Added Test End ++++++++++++++++++++++++++++++++++++++
else
{
llOwnerSay( "Permission to attach denied" ); // shows in local chat if denied. Remark out if not needed
}
}
on_rez(integer rez)
{
if(!llGetAttached())
{ //reset the script if it's not attached.
llResetScript(); //reset the script if it's not attached.
}
}
}