Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

on_rez troubles

Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
01-02-2008 09:15
Happy New Year all!

OK. I'm having trouble getting script commands to trigger in an attachment if the attachment is worn at log on. From the wiki I figured if I stick the calls in and on_rez then it should work.

In fact what I'm finding is that although my script can get the owner key and the size info for the owners bounding box it is not then using that info to resize.

Any help would be great

CODE

default
{
on_rez(integer foo)
{vector size;
float scale;
size = llGetAgentSize(llGetOwner());
llOwnerSay((string)size);
scale = (size.z / 2)*0.95;
llSetPrimitiveParams([PRIM_SIZE, <0.038,0.038,0.038> * scale]);
}

attach(key attached)
{
vector size;
float scale;
size = llGetAgentSize(attached);
scale = (size.z / 2)*0.95;
llSetPrimitiveParams([PRIM_SIZE, <0.038,0.038,0.038> * scale]);
}
}


Correction...The size info is not being read correctly. On log on the height is read as 1.9 but on attach it is read as 1.42339. Can any one say why it reads the height incorrectly on_rez (at log on).
_____________________
Tread softly upon the Earth for you walk on my face.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
01-02-2008 09:33
It's likely that the reason the height value is different is because your avatar's height is actually changing. When you log in, your avatar initially displays the default ("Ruth";) avatar until your shape loads. I bet the script is getting the ruth avatar's size, not your actual avatar's size. Maybe put in an llSleep() call?
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
01-02-2008 09:36
OK. That makes sense. In that case in a slow sim it could take a while for the av height to be read correctly. I figured that was a viewer delay when you end up as Ruth but from what your saying it could scupper any plans to read the av height correctly at log on.
_____________________
Tread softly upon the Earth for you walk on my face.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-02-2008 11:12
you may not want to assume a height for an av anyway, since people can change between avs that may change height, as well as some specialty avs (like tinies) being folded or deformed to create their effects.

if you are truly dependant on it you could toss in a small delay before reading the info... and seeing as you're using the same code in 2 places, outsourcing that bit of code to a function will save you script space
_____________________
|
| . "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...
| -
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
01-02-2008 11:58
I have since changed the method I am using. The height check now happens on touch event as even a 10sec delay didn't seem to always catch the height check properly. I appreciate using av height is not appropriate for everyone but i couldn't think of better way to do what i wanted. I'm building a parasol with AO, raise and lower on command and alter size to match the wearer.

If anyone can think of a better way to do the resize bit I'd be eager to hear them though I'm pretty happy with the formula I'm using based on height.
_____________________
Tread softly upon the Earth for you walk on my face.