Intranet Catprocess
  1. news...
  2. about Blackvoxel
  3. download
  4. manual
  5. videos
  6. about us
  1. A more complete lift

    A voxel lift

    This example show a complete lift with a command panel.

    You must place two input switches in the robot's inventory in order to work. Then start the script and jump on top of the robot.

    You can activate the lift by using middle mouse button on the topmost switch. The other one sets the lift direction.

    // Complete Lift
    
    // Put 2 voxel input switch in the Robot's inventory in order to work.
    // Then climb ont the top of the Robot.

    function IfNoButtonPlaceOne(x,y,z)
    {
    local Voxel;

    Voxel = Look3D(x,y,z);

    if (Voxel == 214 || Voxel == 215) return(true);
    if (Voxel != 0) return(false);
    if (PlaceVoxel3D(x,y,z,214)) return(true);
    if (PlaceVoxel3D(x,y,z,215)) return(true);
    return(false);
    }

    function PlaceButtons()
    {
    if ( IfNoButtonPlaceOne(-1,1,0) && IfNoButtonPlaceOne(-1,2,0)) return(true);
    return(false);
    }

    function Voxel_Step()
    {
    local Diff;

    // Place the buttons if not are here.
    if (!PlaceButtons()) return(1);

    // Read enable button. If not enabled stop.
    if (!Voxel_GetInfo(-1,2,0,1)) return(1);

    // Does player is on top of the lift ?

    Diff = GetInfo(5) - GetY();
    if (GetX() == GetInfo(4) && GetZ() == GetInfo(6) && Diff>=0 && Diff<3)
    {
    // Read the direction button. If enabled, go down
    if (Voxel_GetInfo(-1,1,0,1))
    {
    // If there is something under, stop the lift.
    if (Look3D(0,-1,0) !=0 || Look3D(-1,0,0) !=0) {Voxel_SetInfo(-1,2,0,1,false);return(1);}
    // Move the Lift Down
    PlayerSetAccel(0.0, -550.0, 0.0)
    MoveVoxel3D(-1,1,0,-1,0,0);
    MoveVoxel3D(-1,2,0,-1,1,0);
    Move(5);
    return(1);
    }

    // Move the player up
    PlayerSetAccel(0.0, 1500.0, 0.0)
    // If Player is lifted enough, move the lift up
    if (Diff>1)
    {
    // If there is something on top of the lift, stop
    if (Look3D(0,3,0) !=0 || Look3D(-1,3,0) !=0) {Voxel_SetInfo(-1,2,0,1,false);return(1);}
    // Move the lift Up

    MoveVoxel3D(-1,2,0,-1,3,0);
    MoveVoxel3D(-1,1,0,-1,2,0);
    Move(4);
    }
    }
    }
     
  2. Google+