Sowa Mai Posted April 24, 2018 Share Posted April 24, 2018 (edited) Thanks in advance for any help I can get with this. I have a hard time asking for help so I am really stuck I am trying to give a hud and a phone attachment to visitors to my art installation. I set an invisible prim 7m over the platform at the landing zone with the "giver" script triggered by collision_start. I put it there because if i landed on it i was getting multiple huds! It works sometimes and sometimes other times i get no hud. sometimes it leaves a copy of the hud or the phone on the platform. What am I doing wrong here? here is the giver script triggered by collision: default { state_entry() { llVolumeDetect(TRUE); } collision_start(integer NumberOfCollisions) { integer i = 0; for(; i < NumberOfCollisions; i++) { integer channel = llRound(llFrand(-1000)); key give_to = llDetectedKey(i); llSay(0, "Rezzing HUD for " + (string)give_to + " using channel " + (string)channel); llRezObject("phone3", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, channel); llRezObject("ss-hud-01we5", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, channel); llRegionSay(channel, "ATTACH|" + (string)give_to); } } } and here is the script copied from knowledge base that goes in the attachment and the hud (this one has the experience ticked at the bottom) // Example script for LSL Experience Tools attachment // This script runs on an object that is rezzed in-world which gets // an Experience permissions and then attaches to an AV. integer listener; integer msg_channel; integer log_spam_channel = 0; // Change this or remove llSay() commands default { on_rez(integer start_parameter) { // Start listening for a message from rezzer msg_channel = start_parameter; llSay(log_spam_channel, "Test HUD has been rezzed"); listener = llListen(start_parameter, "", NULL_KEY, ""); } listen(integer channel, string name, key id, string text) { // Listen for the message from the rezzer with the target agent key if (channel == msg_channel) { // Ask for the experience permission list msg = llParseString2List(text, ["|"], []); llSay(log_spam_channel, "Trying experience permissions request to " + llList2String(msg, 1)); llRequestExperiencePermissions((key)llList2String(msg, 1), ""); llListenRemove(listener); llSetTimerEvent(60.0); } } experience_permissions(key target_id) { // Permissions granted, so attach to the AV llSay(log_spam_channel, "Trying llAttachToAvatarTemp()"); llAttachToAvatarTemp(ATTACH_HUD_CENTER_1); llSay(log_spam_channel, "After llAttachToAvatarTemp() with llGetAttached() returning " + (string)llGetAttached()); llSetTimerEvent(0.0); if (llGetAttached() == 0) { // Attaching failed llDie(); } } experience_permissions_denied( key agent_id, integer reason ) { // Permissions denied, so go away llSay(log_spam_channel, "Denied experience permissions for " + (string)agent_id + " due to reason #" + (string) reason); llDie(); } attach( key id ) { // Attached or detached from the avatar if (id) { llSetTimerEvent(0.0); llSay(log_spam_channel, "Now attached with a key " + (string)id + " and llGetAttached() returning " + (string)llGetAttached()); // From this point, the object can start doing whatever it needs to do. state running; } else { llSay(log_spam_channel, "No longer attached"); llDie(); } } timer() { // Use a timer to catch no permissions response llSay(log_spam_channel, "Permissions timer expired"); llDie(); } } // This state starts when permissions are granted and the object is properly attached state running { state_entry() { llSay(log_spam_channel, "off and running!"); } attach(key id) { if (id == NULL_KEY) { // if the object ever un-attaches, make sure it deletes itself llSay(log_spam_channel, "No longer attached"); llDie(); } } } Edited April 24, 2018 by Sowa Mai forgot to add it had experience ticked Link to comment Share on other sites More sharing options...
Xiija Posted April 24, 2018 Share Posted April 24, 2018 (edited) mebbe for the collisions bit... // global var list added = []; // in the script collision_start(integer num) { key give_to = llDetectedKey( 0 ); if (~llListFindList( added ,[ (string)give_to ])) { return; // they already got one! } added += give_to; // else, add them now llSay(0, "Rezzing HUD for " + llKey2Name(give_to) + " using channel " + (string)channel); llRezObject("phone3", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, channel); llRezObject("ss-hud-01we5", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, channel); llRegionSay(channel, "ATTACH|" + (string)give_to); } Edited April 24, 2018 by Xiija 1 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted April 24, 2018 Share Posted April 24, 2018 It looks OK on the face of it. Maybe llSleep the giver script for 0.1 seconds or so before passing the avatar key to the rezzed objects, to give everything a chance to settle down after being rezzed? 1 Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted April 24, 2018 Share Posted April 24, 2018 Some things to consider: Always check that the target has available attach slots by referencing the llGetObjectDetails() constant OBJECT_ATTACHED_SLOTS_AVAILABLE maybe prior to rez, but definitely prior to llAttachToAvatarTemp() else you risk your object changing owners and not attaching. The intended user can then take the object into their inventory or receive the object via autoreturn. I would do an "if (llGetAttached)" call immediately after llAttachToAvatarTemp() and llDie() if it isn't attached. There is also an issue with temp attached HUD's not showing as visible if they are temp attached outside the user's draw distance as well as the issue of high link count mesh HUD's not showing as visible if they are temp attached before the mesh LOD levels are fully loaded. In both cases I rezzed the HUD at high altitude over the target user's location, slept the script for two seconds, then temp attached. 1 1 Link to comment Share on other sites More sharing options...
Sowa Mai Posted April 28, 2018 Author Share Posted April 28, 2018 Hooray!! It works!! thank you so much for the help. I put a llSleep(0.3); in before it attaches and it works now. I am gonna ask for help more often, thank you. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now