Neverworld Grid

You are not logged in. Would you like to login or register?



6/10/2019 6:34 pm  #1


Rez out objects in rows

Rezzes out the contents of a box into multiple rows. ***Sit on the box*** and then click it.
It will move to 10,10,50 then start rezzing the contents out into rows.
After the stuff rezzes out the box will move to 128,128 and become a platform for you to walk on

If you want the box to start higher change that 50 in <10,10,50> to some other value.





SetRegionPosition(vector destination)
{
  llSetRegionPos(destination);
  if(llGetPos() != destination) llSetPos(destination);
}
vector NewPos = <10,10,50>; // Change that 50 if you want to start at some other altitude.
key av;

vector StartPos; vector RezPos; vector GoTo;
float RezX; float RezY; float RezZ;
integer x; integer y;
integer TotalCount; integer Count;
string ObjectName;

default

    state_entry()
    {
      TotalCount = llGetInventoryNumber(INVENTORY_OBJECT);
      llSitTarget(<0.0,0.0,0.5>, ZERO_ROTATION);
      llSetText("Box contains " + (string) (TotalCount -1) + " objects.\nNow sit on it!",<1,1,0>, 1.0);
      llSetClickAction(CLICK_ACTION_SIT);
      llSetTexture(TEXTURE_DEFAULT,ALL_SIDES);
      llSetColor(<1,1,1>,ALL_SIDES);
      llSetStatus(STATUS_PHANTOM, FALSE);
    }

     changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            av = llAvatarOnSitTarget();
            if (av)
            {
                SetRegionPosition(NewPos);
                llSetText("Now touch the box",<1,1,0>,1.0);
                llSetClickAction(CLICK_ACTION_TOUCH); 
            }
        }

        if (change & CHANGED_INVENTORY)
        {
            llResetScript();
        }    
    }  

    touch_start(integer num_detected)
    {
        StartPos = llGetPos();

        RezPos = StartPos + <0,3,2.5>;
        SetRegionPosition(RezPos);

        RezX = RezPos.x;
        RezY = RezPos.y;
        RezZ = RezPos.z;
        Count = 0;

       for (y=0; y<10; y++)
        {
            for (x=0; x<10; x++)
            {
            GoTo = <RezX + (x * 10),RezY + (y * 10), RezZ>;  
            SetRegionPosition(GoTo);

            ObjectName = llGetInventoryName(INVENTORY_OBJECT, Count);

            if (ObjectName != "")
            {
                llOwnerSay(" Rezzing " + (string) Count + " out of " + (string) TotalCount + " " +  ObjectName);
                llRezAtRoot(ObjectName, llGetPos(),ZERO_VECTOR,ZERO_ROTATION,0);
 //               llRezAtRoot(".INDICATOR",llGetPos() + <0,0,-2.5>, ZERO_VECTOR,ZERO_ROTATION,0);
                Count++;
            }

           }
        }

       
        SetRegionPosition(StartPos);
        llSetScale(<10,10,0.1>);
        llUnSit(av);
        SetRegionPosition(<128,128,StartPos.z>);
        llSetScale(<256,256,0.1>);
        llSay(0,"Deleting the extra stuff");
        llSetText("", <0,0,0>,0.0);

        llSetClickAction(CLICK_ACTION_TOUCH);
//        llRemoveInventory(".INDICATOR");
        llRemoveInventory(llGetScriptName());
    }
 
}

 

8/21/2020 3:10 pm  #2


Re: Rez out objects in rows

How is this a database problem?
It does what its supposed to do....
If you want to change this behavior you will have to find where it despawns them in the code and change it.

 

Board footera

 

Powered by Boardhost. Create a Free Forum