Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HUD Scripting Questions

Dzar Overlord
Registered User
Join date: 16 Mar 2007
Posts: 8
03-16-2007 02:20
Hey there. I've been trying to script a HUD program but have been having problems with it. I'm simply trying to get objects in the HUD to work nicely with each other. I'd like it so that when I click on the object in the background, the object in the foreground will either move to the back or die (with the ability to respawn later where it was). If someone could help me out I'd be grateful.

I've tried to get an item attached to the HUD to spawn an object on the HUD. When I try using llRezObject it rezzes the second object (a linkset in this case) in world relative to my avatar and not the HUD.

Instead of llRezObject I tried just changing the position of the object in the foreground to move to the background. I linked the two objects together as I would preferably have it all as one object so that the user only has to attach an object once and be done. Not to mention it'd save the other slots in the HUD for other things. I've tried using llSetPos and llSetPrimitiveParams and neither seem to even budge the object. I first set a variable to llGetPos and then add/subtract the position change ( vector x = llGetPos() - <.015,0,0>; ) using that variable in the ll function calls. Didn't work although when I have it output using llOwnerSay((string)x) it gives me the modified value. It just doesn't seem to wanna change it on the object.

Another question I do have is do scripts in HUD run client side or server side?

Again, any help will be much appreciated. Thanks.




The script in the root prim:

default
{
state_entry() {}

touch_start(integer total_number)
{
llMessageLinked(-2, 0, "move", "";);
}
}


The script in the child prim:

default
{
state_entry() {}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "move";)
{
vector x = llGetPos() - <1.015,0,0>;
llSetPrimitiveParams([PRIM_POSITION, x]);
llOwnerSay((string)x + " " + (string)llGetPos());
}
}
}

The llOwnerSay is simply to get a feedback of the values which say: <134.27940, 52.19864, 700.31042> <135.29440, 52.19864, 700.31042>.

Thanks again for the help.
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
03-16-2007 04:35
Rezzing/derezzing on demand will not work.

The way to work this is to have the elements either move or rotate out of the way when they're not needed.
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
03-16-2007 05:18
Indeed; if you wanted to rez parts it's require having the HUD detach itself, rez bits, link, then attach itself again - takes ages and messes up if you're moving.

llSetPrimitiveParams definitely works, I'm doing it on my current project, so there must be some problem with your code. Some more info (preferably some code) might help.

HUD scripts are run server-side.