Jump to content

HUD Prim Description is not saved when detached [Solved]


You are about to reply to a thread that has been inactive for 2854 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I updated the code to work by using the child linked prim to store the position and size.  Thanks Parrish!

 

======

I am trying to use the Description field to store info about a HUD, position and size.  I have used this technique in the past for many Prims but the first time in a HUD (it does have a child prim btw).  Anyway the code below seems to change the description fine if I leave the HUD on screen.  But as soon as I detach it , the description changes to (no description).  If I rez it to the ground, click it, take it, and re rez it to the ground the description remains.   So not as a HUD it works as expected, but if it is used as a HUD it loses the description that was changed via the script.  

I know I have discovered many things about a HUD that are different, is this one of them?

 

vector hudPosition;
vector hudSize;


HudPosSize2Desc()
{
    list lInfo = llGetPrimitiveParams([PRIM_POS_LOCAL,PRIM_SIZE]);
    string pos_size =   (string)llList2Vector(lInfo,0) + ";" + 
                        (string)llList2Vector(lInfo,1);
    
    llSetLinkPrimitiveParamsFast(2,[PRIM_DESC,pos_size]);
    llOwnerSay("HudPosSize2Desc() called " + (string)pos_size);
}

HudPosSizeFromDesc()
{
    string info = llList2String(llGetLinkPrimitiveParams(2,[PRIM_DESC]),0);
    list linfo = llParseString2List(info,[";"],[]);

    hudPosition = (vector)llList2String( linfo,0);
    hudSize    = (vector)llList2String( linfo,1);
    
    llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION,hudPosition,PRIM_SIZE,hudSize]);
}
      
default
{
    state_entry()
    {
        HudPosSizeFromDesc();
        llOwnerSay("Position: " + (string)hudPosition);
        llOwnerSay("Size: " + (string)hudSize);         
    }
    
    on_rez(integer start_param)
    {
        llResetScript();
    }
 
    touch_end(integer s)
    {
        HudPosSize2Desc();        
    }
}

 

Link to post
Share on other sites
  • 2 weeks later...
You are about to reply to a thread that has been inactive for 2854 days.

Please take a moment to consider if this thread is worth bumping.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...