Jump to content

HUD Prim Description is not saved when detached [Solved]


xtc4u
 Share

You are about to reply to a thread that has been inactive for 4156 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 comment
Share on other sites

  • 2 weeks later...
You are about to reply to a thread that has been inactive for 4156 days.

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
 Share

×
×
  • Create New...