Climb Pole

Written by: Headmaster
vector gvSitTarget ;

Reset()
{
    vector vPrimSize = llGetScale();
    gvSitTarget = <0.0, 0.0, (vPrimSize.z / 2) + 0.1>;
    
    llSetSitText("Climb up");
    llSetTouchText("Reset");
    llSitTarget(gvSitTarget, llGetRot());
}
default
{
    state_entry()
    {
        Reset();
    }
    touch_start(integer num_detected)
    {
        Reset();
    }
    changed(integer change)
    {
        if(change == CHANGED_LINK)
        {
            //llOwnerSay("Changed");
            
            key avatar = llAvatarOnSitTarget();
            
            //llOwnerSay("Detected:" + llKey2Name(avatar));
            
            if(avatar != NULL_KEY)
            {
                llSleep(1.0);
                // llOwnerSay("Unsit");
                llUnSit(avatar);
            }
        }
    }           
}