Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HUD Question

Ruboneout Shoreman
Registered User
Join date: 29 Jul 2009
Posts: 38
10-29-2009 20:57
A friend of mine asked me to make him a HUD, and I am by no means great at scripting but I am trying to learn and become better. I wanted to make the HUD move when you click on it. Such as having it expand and collapse when you click on an arrow so you can hide it if you want. Could anyone tell me how I would go about doing this? I don't need an exact script on how I would do something like that, you can provide one if that floats your boat, but I was wondering what functions I would use. Thank you very much for your times and efforts.
Padraig Swordthain
The Thin Mick
Join date: 7 Jan 2009
Posts: 11
10-29-2009 21:14
http://lslwiki.net/lslwiki/wakka.php?wakka=llSetPos

This is the function that the OpenCollar Sub AO HUD uses, to move the buttons based on what position the HUD is attached:
CODE

list attachPoints = [
ATTACH_HUD_TOP_RIGHT,
ATTACH_HUD_TOP_CENTER,
ATTACH_HUD_TOP_LEFT,
ATTACH_HUD_BOTTOM_RIGHT,
ATTACH_HUD_BOTTOM,
ATTACH_HUD_BOTTOM_LEFT
];

// For the on/off (root) prim
list rootPrimOffsets = [
<0.0, 0.025, -0.05>, // Top right
<0.0, 0.025, -0.05>, // Top middle
<0.0, -0.025, -0.05>, // Top left
<0.0, 0.025, 0.10>, // Bottom right
<0.0, 0.00, 0.10>, // Bottom middle
<0.0, -0.025, 0.10> // Bottom left
];

// For the menu (child)
list menuPrimOffsets = [
<0.0, 0.0, -0.057>,
<0.0, -0.057, 0.0>,
<0.0, 0.0, -0.057>,
<0.0, 0.0, 0.057>,
<0.0, 0.0, 0.057>,
<0.0, 0.0, 0.057>
];

// For the SitAnywhere Button (child)
list sitAWPrimOffsets = [
<0.0, 0.0, -0.114>,
<0.0, -0.114, 0.0>,
<0.0, 0.0, -0.114>,
<0.0, 0.0, 0.114>,
<0.0, 0.0, 0.114>,
<0.0, 0.0, 0.114>
];

DoPosition()
{
// Using 2 for the child prim's link number... if you
// want to add prims that need to be moved, you'll
// have to do work here

integer position = llListFindList(attachPoints, [llGetAttached()]);
if (position != -1) {
llSetPos((vector)llList2String(rootPrimOffsets, position));
llSetLinkPrimitiveParams(2, [PRIM_POSITION, (vector)llList2String(menuPrimOffsets, position)]);
llSetLinkPrimitiveParams(3, [PRIM_POSITION, (vector)llList2String(sitAWPrimOffsets, position)]);
}
}


I think this can probably serve as a starting point for what you're trying to do.
_____________________
Incidental Radio :: Because nothing is by design
Ruboneout Shoreman
Registered User
Join date: 29 Jul 2009
Posts: 38
10-29-2009 21:31
Seems like it. Thank you!