Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HUD region change

Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
04-25-2008 02:31
Hello,

I have an object in my HUD that rezzes upon arriving at a new region.
I have used llRezObject to a success, with REGION_CHANGE.
Every time i teleport the object rezzes, which is exactly what i want it to do.

My question, is there a way to have this script listen to my HUD so i can turn this script on and off?
in my HUD it is a little something like this:

default
{
changed(integer change)
{
if (change & CHANGED_REGION)
{
llRezObject("Object", llGetPos() + <0.0,0.0,0.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
}
}
}

Thanks.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-25-2008 07:03
If I'm reading you correctly, you want to be able to toggle the functioning of the rezzed object on and off. If So, this should do it.

In the hud...

CODE

integer toggle = TRUE;

default
{
changed(integer change)
{
if (change & CHANGED_REGION)
{
llRezObject("Object", llGetPos() + <0.0,0.0,0.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
}
}

touch_start (integer foo)
{
if (toggle)
{
llSay (-123456, "OBJECT_ON");
}

else
{
llSay (-123456, "OBJECT_OFF");
}
}
}


then... in the rezzed object...
CODE

default
{
state_entry()
{
handle = llListen (-123456,"",NULL_KEY,"");
// plus any of your state entry code...
}

// your object's code...

listen (integer channel, string name, key id, string message)
{
if (message == "OBJECT_OFF")
{
state idol;
}
}
}

state idol
{
listen (integer channel, string name, key id, string message)
{
if (message == "OBJECT_ON")
{
state default;
}
}
}


... should do it.
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
04-25-2008 07:42
Sort of..

The object is in my HUD
In my HUD the following script is inserted:

default
{
changed(integer change)
{
if (change & CHANGED_REGION)
{
llRezObject("Object", llGetPos() + <0, 0, 1.0>, ZERO_VECTOR, ZERO_ROTATION, 42);
}
}
}

So when i teleport the Object will rez with me.
When i attach my HUD i have made a dialog come down with the options On and Off.
So what i need it to do is when i click on, it reads the above script and when off clicked, it doesnt. (the HUD channel is -46)
Hope that makes sense
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-25-2008 10:27
Just turn the script off & on:

http://www.cheesefactory.us/lslwm/llSetScriptState.htm
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
04-26-2008 11:35
works perfect! thanks
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
04-29-2008 11:58
Hmm, why does this rez the objects when i cross sims?

I only want to rez the objects when teleported.

Thanks
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-29-2008 12:25
From: Turokhan Legion
Hmm, why does this rez the objects when i cross sims?

I only want to rez the objects when teleported.

To SL there really isn't much difference between when you teleport and when you cross a boundary between adjacent sims. You could test and remember llGetRegionCorner() and llGetPos() to try to judge whether you have teleported or simply moved across a region border to the close edge of a neighboring sim I guess.

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetRegionCorner
Zenick Aridian
Registered User
Join date: 1 Nov 2005
Posts: 8
04-29-2008 13:55
You need to replace CHANGED_REGION to CHANGED_TELEPORT for it to work only on teleports.