Saturday, December 10, 2011

height script

Tired of discussing what is the correct height? Realistically?
Copy and paste this script into a prim and let others just walk against that prim, maybe as non intrusive doormat or similar...

(Update January 6, 2012:) the script below has a bug. Read the comments, or see the corrected version here: http://yournymph.blogspot.com/2012/01/giants.html )

default
{
    state_entry()
    {
     
        llSetText( "", < 1,1,1>, 1 );
    }


    collision_start (integer total_number)
    {
        key avatar;
        string name;
        vector size;
        vector pos;
        string saeheight = "";
        float heightfeet;


        avatar = llDetectedKey(0);
        size   = llGetAgentSize( avatar );
        name   = llDetectedName(0);
        pos    = llDetectedPos(0);
       
       heightfeet = size.z * 3.28083;
saeheight = (string)((integer) llFloor(heightfeet)) + " feet ";
heightfeet -= llFloor(heightfeet);
saeheight += (string)((integer)(llRound(heightfeet * 12))) + " inches";
        llInstantMessage(avatar, "you are " +saeheight + " tall, that equals " + (string)((integer)(size.z*100)) + " cm");
        if (size.z*100<150)
{
        llInstantMessage(avatar, "Your size is small. This is just a hint. Nothing else.");
}
       else  if (size.z*100>200)
{
        llInstantMessage(avatar, "Your size is very tall. This is just a hint. Nothing else.");
}
       
        size.x = 0.5;
        size.y = 0.5;
     


    }
}

2 comments:

  1. This script seems to be reading AgentHeight and just giving that. That's not actually correct avatar size, it's the size of an invisible physics box connected to your avatar and that box is significantly shorter than your avatar.

    For instance, my avatar is 5'7"/173cm, but this script gives my AgentHeight, which is only 5'1"/156cm.

    You can confirm this discrepancy by rezzing a pose stand and a prim, sitting on the pose stand, then stretching the prim from the bottom of your feet to the top of your avatar's skull. (Remember, scripted height detectors will count avatar shoes but not prim attachments like hair or furry avatar heads.)

    There's been a Jira issue requesting LL fix AgentHeight since it causes so much confusion, but like many bugs they haven't gotten around to it yet.

    Here is a script made to give accurate avatar height. It uses a math fudge to calculate avatar height from AgentHeight, but it should only be off by a couple centimetres rather than half a foot!


    //string search = "";

    integer loud = FALSE;

    test(key id) {
    string name;
    string saeheight = "";
    vector size;
    name = (llKey2Name(id));
    size = llGetAgentSize(id);
    float heightfeet;
    float m = size.z;
    m *= 1.1057; // Multiplier
    float f = m * 3.28083;
    integer ft = (integer)f;
    float f2 = f - (float)ft;
    integer in = (integer)(12.0 * f2);
    heightfeet = size.z * 3.28083;
    saeheight = (string)((integer) llFloor(heightfeet)) + " ft. ";
    heightfeet -= llFloor(heightfeet);
    saeheight += (string)((integer)(llRound(heightfeet * 12))) + " in.";
    llSay(0, llKey2Name(id) + " is " + (string)m + " m (" + (string)ft + " ft. " + (string)in + "in.) tall. (counting shoes) - Accurate SL Height");
    vector junk = llGetScale();
    //llSetScale();

    }

    string round_float(float value) {
    string result = (string)value;
    return llGetSubString(result, 0, llSubStringIndex(result, ".") + 2);
    }

    default {
    touch_start(integer num) {
    test(llDetectedKey(0));
    }
    }

    ReplyDelete
  2. thank you Penny. i corrected my script and posted it anew here: http://yournymph.blogspot.com/2012/01/giants.html

    ReplyDelete

LinkWithin

Related Posts Plugin for WordPress, Blogger...