Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Positioning a HUD unsuccessfully

Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-26-2009 18:50
I've been having occasional problems with a few people who can't see a HUD on screen when they attach it, so I figured I would write a simple routine to help them out. If I do it right, this script should activate on rez and then let the user move the HUD around on the screen with simple chat commands in channel 99. When the user finally gets the HUD where she wants it, she hits the "Yes" button in the dialog box, removing listen handles and preventing further movement. It seems easy enough except ......

1. When I test the script, using a 0.06m sq cube, the up/down commands work fine but the left/right ones don't. LR+ or LR- move the HUD up and down, not left and right. WHY??????

2. It's silly and annoying, but I can't make the dialog box go away.

CODE

vector CurrPos;
integer CHANNEL = -57;
list yesno = ["Yes","No"];
integer dialog;
integer move;
default
{
on_rez(integer start_param)
{
integer Aspot = llGetAttached();
if (Aspot == 31)
{llOwnerSay("I am attached at Center2.");}
else if (Aspot == 32)
{llOwnerSay("I am attached at Top Right.");}
else if (Aspot == 33)
{llOwnerSay("I am attached at Top.");}
else if (Aspot == 34)
{llOwnerSay("I am attached at Top Left.");}
else if (Aspot == 35)
{llOwnerSay("I am attached at Center.");}
else if (Aspot == 36)
{llOwnerSay("I am attached at Bottom Left.");}
else if (Aspot == 37)
{llOwnerSay("I am attached at Bottom.");}
else if (Aspot == 38)
{llOwnerSay("I am attached at Bottom Right.");}
else
{llOwnerSay("I am not attached.");}
llSetPos(<0.0,0.0,0.0>);
CurrPos = llGetLocalPos();
llSetLocalRot(ZERO_ROTATION);
llDialog(llGetOwner(),"Can you see me?", yesno,CHANNEL);
dialog = llListen(CHANNEL,"",NULL_KEY,"");
move = llListen(99,"",llGetOwner(),"");
}

listen(integer channel, string name, key id, string message)
{
if (message == "Yes")
{
llListenRemove(dialog);
llListenRemove(move);
}
else if (message == "No")
{
llOwnerSay("OK, to move me right or left type /99 RL+ or /99 RL-");
llOwnerSay("To move me up or down type /99 UD+ or /99 UD-");
}
else if (message == "RL+")
{llSetPos(CurrPos + <0.0, 0.1,0.0>);}
else if (message == "RL-")
{llSetPos(CurrPos + <0.0,-0.1,0.0>);}
else if (message == "UD+")
{llSetPos(CurrPos + <0.0,0.0,0.1>);}
else if (message = "UD-")
{llSetPos(CurrPos + <0.0,0.0,-0.1>);}
CurrPos = llGetLocalPos();
llOwnerSay("I am at " + (string)llGetLocalPos() + ".");
llDialog(llGetOwner(), "Can you see me?", yesno, CHANNEL);
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-26-2009 19:15
try the x axis =P y is depth and only good fo control depth of overlayed elements
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-26-2009 19:21
I actually tried the X axis first. It didn't work, so that's why I tried Y. Then I yelled HELP. :o I figured it was my simple lack of understanding of the coordinate system, but it's beginning to look like more than that.

Edit: And I just tried it again with the X axis. No luck. LR+ and LR- both have the same effect as UD- ... they move the HUD down. The only thing that moves the HUD another direction is UD+, which correctly moves it upwards.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-26-2009 19:55
y works for me inworld

CODE

default{
touch_start(integer total_number){
llSetPos( <0,0,0> );
llSetPos( <0.0, 0.1, 0.0>) );
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-26-2009 20:06
From: Void Singer
y works for me inworld

CODE

default{
touch_start(integer total_number){
llSetPos( <0,0,0> );
llSetPos( <0.0, 0.1, 0.0>) );
}
}


Wierd. That doesn't do a thing for me. Just sits there. No movement of any kind.

Neither does this

CODE

default{
state_entry() {
llSetPos( <0,0,0> );
}
touch_start(integer total_number){
llSetPos( llGetPos() + <0.1, 0.0, 0.0>) ; // Or llSetPos(llGetPos() + <0.0,0.1,0.0>);
}
}


Is SL being strange tonight, or am I cursed?
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-26-2009 20:46
From: Rolig Loon
Wierd. That doesn't do a thing for me. Just sits there. No movement of any kind.

Neither does this

CODE

default{
state_entry() {
llSetPos( <0,0,0> );
}
touch_start(integer total_number){
llSetPos( llGetPos() + <0.1, 0.0, 0.0>) ; // Or llSetPos(llGetPos() + <0.0,0.1,0.0>);
}
}


Is SL being strange tonight, or am I cursed?

my version should have centered and then hoped left a hair... you second script needs to use get LOCAL or it'll return sim coordinates.

ETA:
in your original script you need to move the set position, or it they are withn 10m of the SW corner and rez it inworld it'll jump to the sim corner... there's also no point in setting curpos in the onrez after you've already told it to move to the center of that hud point. since it's ZERO_VECTOR already because you just set it there =)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-26-2009 21:14
From: Void Singer
my version should have centered and then hoped left a hair... you second script needs to use get LOCAL or it'll return sim coordinates.

ETA:
in your original script you need to move the set position, or it they are withn 10m of the SW corner and rez it inworld it'll jump to the sim corner... there's also no point in setting curpos in the onrez after you've already told it to move to the center of that hud point. since it's ZERO_VECTOR already because you just set it there =)


Odd... I relogged and cleared cache. Yours works fine now, and mine (corrected to use llGetLocalPos() ) does too. So the proper axes for moving a HUD on the screen are Y and Z, as I thought at first. So...... Why isn't my original script letting me move left and right? Commands to LR+ or LR- still move the HUD down, not left or right.

Thanks for catching the unnecessary CurrPos line in on_rez, BTW. It was an artifact of an earlier try. I also caught a missing = in my last if test in the listen event.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-26-2009 21:43
WHOA! It works. I cannot explain it at all. All I did was to change the triggering messages for left/right motion from RL+ and RL- to LR+ and LR-. I didn't do anything else at all. The HUD can move in any direction now.

The only minor mystery is how to get rid of the dialog box. :p
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-27-2009 09:19
move the dialog call that's in the listen? actually you could buttonize all your commands and ad a "done" button, or just use a timeout to kill the listen...
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-27-2009 11:40
Yup... That part really was a minor mystery. Once I got that little script to work, finally, I incorporated it into the HUD itself this morning, all driven by dialog buttons. I can't get in world to give it a field test until this evening, but it compiles OK and feels right now.

I still can't figure out why simply coding it to listen for LR+ or LR- instead of RL+ or RL- would suddenly make the routine work. There must have been goblins at work last night. :confused:

Thanks again, Void. :D
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at