Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Toupie

Pages: 1 2 [3] 4 5
31
General Discussion / Re: Water to Sequencer?
« on: October 17, 2013, 12:53:39 am »
It seems it is my water that is acting up. If I put an Materializer so it outputs water from a compressor in direction 0, 1 or 4 the water will not fall or act as water, but if I rotate it so it outputs the water in directions 2, 3 or 5 it all works as expected.

So it wasn't the Sequencer that was the fault, it was the water.

32
General Discussion / Water to Sequencer?
« on: October 16, 2013, 09:50:00 pm »
How do I feed a sequencer with water?
Other then manually putting it in the Input area of the sequencer that is.


33
Programming with Blackvoxel / Complex Mining Robot Restarter
« on: October 16, 2013, 05:30:38 pm »
This is a script that is build on Qon's Simple Mining Robot Restarter.

This version can handle several compressors with 4 robots each.
There are a number of settings you can change at the top of the script to make it do what you want to.
If there is anything you want it to do that it can't, feel free to add that to the script your self  :P

Documentation is in the script.

Code: [Select]
// Complex Mining Robot Restarter
//
// Define the size of how many compressor/robots for it to manage.
// Place the Computer where you want it to start placing the first compressor/robots.
// Load it with the exact amount of Robots it needs (SizeX *  SizeZ * 4)
// Load it with at least the number of Atomic Compressors it need. If you are using "Master" compressors
//   you need to give it at least one more then the number compressor/robots to manage, and more if you want
//   it to place new "master" compressors along the way to speed things up and make it able to go deeper then -192 from the start.
// Start the script. (I recommend that you leave script 0.nut empty and give this script a higher number so you can load it with
//   with compressors and robots before starting it.)
// Stand somewhere inside the area being mined to follow it down to prevent the robots to move outside of the loaded area.
//
// Set BuildStarts <- 1 to have it automaticaly build a staircase right next to the "Master" compressors for easy access
//  to the "master" compressors and going up and down.
//
// For now the only time it can handle a load is when it is standing on top of the first compressor waiting for the robots to finish.
// This will be fixed when I will be able to save and restore variables.

Debug <- 1;           // Output debug info. 0=Only errors to stderr.txt 1=Errors to Display and to stderr.txt 2=Info and error to display and stderr.txt
SizeX <- 4;           // Number of compressor/robot sets to manage in X axis (8 is max practical value)
SizeZ <- 4;           // Number of compressor/robot sets to manage in Z axis (8 is max practical value)
UseMasterCompressor <- 1;  // Use one "master" Atomic Compressor to empty the computer to after every iteration. (Strongly recomended)
NewMasterAfter <- 128;// How often to place a new "Master" Atomic Compressor (Need to be <= 192. Make it an even 16 please, and anything less the 64 is a waste.)
BuildStairs <- 2;     // 0=Do not build stair, 1=Build Stair outside mining area, 2=Build stair inside mining area. (Only works if UseMasterCompressor is on)
MaxLevel <- -575;     // Don't place robots deeper then this. (Going below -1340 is dangerous)
Robot <- 153;         // The VoxelType of our robots. 153=XR-1(8*16*8) 154=XR-2(8*32*8) 155=XR-3(8*32*8) 156=XR-4(8*64*8) 157=XR-5(16*64*16) 158=XR-Z(16*64*16)
Compressor <- 49;     // The VoxelType of the Atomic Compressor (Should be 49 unless the game is changed)

// ============= DON'T CHANGE ANYTHING BELOW THIS ===========

Path <- {
  // Stair 2 Wide 4 High 16 Down. Size 7x7. Builds floor and railings if in empty space
  [0] = [ 9, 12, 12, 8, 13, 13, 13, 21, 16, 10, 21, 18,
          9, 12, 12, 8, 13, 13, 13, 21, 16, 10, 21, 18,
          9, 12, 12, 8, 13, 13, 13, 21, 16, 10, 21, 18,
          9, 12, 12, 8, 13, 13, 13, 21, 16, 10, 21,
          9, 12, 12, 12, 8, 13, 13, 13, 21, 16, 17, 10, 21, 17, 18,
          11 ],
  // Doorway 2 Wide 3 High. Ends in the same location it started
  [1] = [ 9, 9, 12, 12, 8, 13, 5, 10, 13, 11, 11 ],

  // Stair 2 Wide 4 High 16 Down. Size 7x7. Builds floor and railings if in empty space
  [2] = [ 21, 8, 21, 11, 21, 10, 21,
          11, 13, 21, 18, 8, 21, 16,
          11, 13, 21, 16, 10, 21, 18,
          11, 13, 21, 18, 8, 21, 16,
          11, 13, 21, 10, 21, 18,
          11, 21, 18, 19, 8, 21, 19,
          10 ]
};
PathNo <- 0;

// StartX             // The X pos we started at
// StartZ             // The Z pos we started at
// CurrentC           // What compressor are we working with
// State              // What are we currently doing
// MiningSize         // How wide the Robot mines.
// MiningLevel        // The level where the latest compressors where placed from
// MasterLevel        // The Y pos of the latest master
// StairsLevel        // Stairs are built to this level
// Step <- 0;         // Current step in the path
// Rotation <- 0;     // Current rotation adjustment

Time <- 0;
LastState <- 0;
UnknownReturn <- 256000;
NextC <- 0;
NumC <- 0;
PullC <- 0;

/*
Logic:
Place all compressor/robots
Place Master Compressor if not already placed.
Empty Computer into Master Compressor
Empty all compressors
Dig staircase down to mining level.
Go to the compressors and wait for there robots to finish.
Pick up all the mined material, robots and the compressors.
Go down to the bottom of the mine shaft.
Restart
*/

function Voxel_Load()
{
  Time = GetGameTime() - 2000;
  if ("State" in getroottable()) {
    log_file("Starting at State "+State);
  } else {
    ::State <- 0;
  }
  if ("CurrentC" in getroottable()) {
    log_file("Working on Compressor "+CurrentC);
  } else {
    ::CurrentC <- 0;
  }
  if ("MasterLevel" in getroottable()) {
    log_file("Using old MasterLevel of "+MasterLevel);
  } else {
    ::MasterLevel <- 1;
  }
  if ("StartX" in getroottable()) {
    log_file("Using old StartX of "+StartX);
  } else {
    ::StartX <- GetX();
  }
  if ("StartZ" in getroottable()) {
    log_file("Using old StartZ of "+StartZ);
  } else {
    ::StartZ <- GetZ();
  }
  if ("MiningLevel" in getroottable()) {
    log_file("Using old MiningLevel of "+MiningLevel);
  } else {
    ::MiningLevel <- 1;
  }
  if ("Step" in getroottable()) {
    log_file("Using old Step of "+Step);
  } else {
    ::Step <- 0;
  }
  if ("Rotation" in getroottable()) {
    log_file("Using old Rotation of "+Rotation);
  } else {
    ::Rotation <- 0;
  }
  if ("StairsLevel" in getroottable()) {
    log_file("Using old StairsLevel of "+StairsLevel);
  } else {
    ::StairsLevel <- 0;
  }
  if (Robot<153)
    Robot = 153;
  else if (Robot>158)
    Robot = 158;
  if (Robot>=157) {
    ::MiningSize <- 16;
  } else {
    ::MiningSize <- 8;
  }

  if ("NumR" in getroottable()) {
    log_file("Using old NumR of "+NumR);
  } else {
    ::NumR <- GetQuantity(Robot);
  }

  if (NewMasterAfter > 192)
    NewMasterAfter = 192;
  if (NewMasterAfter < 16)
    NewMasterAfter = 16;
  NewMasterAfter = (NewMasterAfter / 16) * 16
  if (BuildStairs == 2)
    PathNo = 2;
}

function Voxel_Unload()
{
}

function Voxel_Step()
{
    local i,j,v,q,b;

    if ( (GetGameTime() - Time) > 1 )  // To run the script in slow-motion set time to wait to 1000 or higher
    {
       Time = GetGameTime();
    } else {
       return;
    }

    if (LastState != State) { // Only log on State change
        log_file("State="+State+" CurrentC="+CurrentC);
        LastState = State;
    }

    switch (State)
    {
        case 0: // Start up State. Try to figure out what to do
            if (Look(5) == Compressor) {
                // If we start ontop of a Compressor we just assume this is compressor set 0. (Since this is where we spend most of our time.)
                // This is the best we can do until there is a way to save variables
                StartX = GetX();
                StartZ = GetZ();
                MasterLevel = UnknownReturn;
                MiningLevel = GetY();
                StairsLevel = GetY() -1;
                CurrentC = 0;
                State = 5;
                log_info("Starting at compressor 0 X:"+StartX+" Y:"+MasterLevel+" Z:"+StartZ+" CurrentC:"+CurrentC);
                break;
            }
            if (GetQuantity(Robot)>=(SizeX*SizeZ*4)) { // We have all our robots.
                if (GetQuantity(Compressor)>=(SizeX*SizeZ+UseMasterCompressor)) { // and our compressor.
                  // Start from scratch.
                  StartX = GetX();
                  StartZ = GetZ();
                  MiningLevel = GetY() + 1;
                  MasterLevel = GetY() + 1;
                  StairsLevel = GetY();
                  CurrentC = 0;
                  log_info("Starting from scratch X:"+StartX+" Y:"+MasterLevel+" Z:"+StartZ+" CurrentC:"+CurrentC);
                  State = 40;
                  break;
                } else {
                  log_err("Wrong amount of Atomic Compressors. Have "+GetQuantity(Compressor)+" but need "+(SizeX*SizeZ+UseMasterCompressor) );
                }
            } else {
              log_err("Wrong amount of Robots. Have "+GetQuantity(Robot)+" but need "+(SizeX*SizeZ*4) );
            }
            Time = Time + 5000;
            break;

        case 5: // Move down until we find a Compressor
          v = Look(5);
          if (v!=Compressor) {
              if (!Move(5)) {
                  log_err("Could not move down to my compressor "+CurrentC);
              }
          } else {
              log_info("Waiting for Robots for set "+CurrentC);
              NumR = GetQuantity(Robot);
              PullC = 0;
              State = 10;
          }
          break;

        case 10:  // Waiting on top of a compressor for all the robots to finish there work.
            if (Look(5)==Compressor) {
                j = 5000; // Limit the amount of voxels to pull every step (It will still only take us 4 seconds to empty the compressor)
                while(PullVoxelFrom(5) && j>0) { // Pull voxels from the atomic compressor
                    j--;
                }
                if (j>0) { // We didn't reach our pull limit so check if the robots done
                    if (GetQuantity(Robot)>=(NumR+4)) { // If all mining robots are picked up then we can move on as soon as the compressor is empty
                        State = 11;
                    } else {
                        // Check for storage full
                        if (UseMasterCompressor && IsStorageFull()) {
                            State = 15; // Handle storage full
                        } else {
                            // Robots not yet ready, so we can take a rest (This is to prevent the script from using unnessesary cpu time while just waiting)
                            Time = Time + 1000;
                        }
                    }
                }
            } else {
                // Something is wrong.
                log_err( "No Atomic compressor found a set "+CurrentC+". Moving on!" );
                CurrentC++;
                State = 20;
            }
            break;
        case 11: // Just because we have our robots doesn't mean the compressor is empty. But one last pull should be enough
            if (Look(5) == Compressor) {
                if(!PullVoxelFrom(5) && PullC>0) {
                    // Check that we didn't fail to Pull voxels because our storage is full.
                    if (IsStorageFull()) {
                      State = 15;
                    } else {
                      NumC = GetQuantity(Compressor);
                      State = 12;
                    }
                } else {
                    PullC++;
                    State = 10;
                }
            } else {
                State = 10;
            }
            break;
        case 12: // Pick up Atomic Compressor
            if (Look(5) == Compressor) {
                log_info("Picking up Compressor for set "+CurrentC);
                PickVoxel(5);
                if (GetQuantity(Compressor)>NumC) { // Make sure the atomic compressor is on board
                    State = 20;
                    CurrentC++;
                } else {
                    // Computer storage is probably full.
                    log_err("Can't pick up the Atomic Compressor for set "+CurrentC+". Is my storage full?");
                    if (IsStorageFull())
                        State == 15;
                }
            } else {
                State = 10;
            }
            break;

        case 15: // My storage is full
            if (UseMasterCompressor) {
                log_info("My storage is full. Moving to master to empty my self.");
                NextC = CurrentC; // Save this compressor to process it next
                CurrentC = SizeX * SizeZ;
                State = 50; // Go empty me
            } else {
                State = 16;
            }
            break;
        case 16: // Signal that I need to be manually emptied
            if (IsStorageFull()) {
                log_err("My storage is full! PLEASE EMPTY ME!");
                Time = Time + 15000;
            } else {
                State = 10;
            }
            break;

        case 20: // Move to the next Compressor to pick up
            if (MoveToNextCompressor(0)) {
                if (CurrentC==0) { // Are we back to the first Compressor?
                  State = 30;
                } else {
                  State = 5;
                }
            }
            break;

        case 30: // The compressors and all mining bots are in storage so its safe to dig down.
            if (GetY() < MaxLevel) {
              log_info("Hit max level. Just going to empty my storage then I stop my work.");
              State = 100;
              break;
            }
            // Check if we have hit bottom
            i = 0;
            for (j=0; j<4; j++) { // Count the number of solid voxels on our sides
                v = Look(j);
                b = GetVoxelProp(v,0)
                if (!b) {
                    i++;
                }
            }
            if (i>2) { // We have hit bottom
                State = 35;
            } else {
              SafeMove(5);
            }
            break;
        case 35: // Move up one so we are above the bottom
            if (SafeMove(4)) {
                State = 40;
            }
            break;

        case 40: // We are now in position to place the mining robots
            log_info("Placing Robots for set "+CurrentC);
            for (i=0; i<4; i++) {
                if (SafePickVoxel(i))
                    PlaceVoxel(i, Robot);
            }
            State = 41;
            break;
       case 41:
            if (SafeMove(4))
                State = 42;
            break;
        case 42: // Place the atomic compressor between the mining bots
            log_info("Placing Compressor for set "+CurrentC);
            PlaceVoxel(5, Compressor);
            if (CurrentC==0)
                MiningLevel = GetY();
            CurrentC++;
            State = 43;
            break;
        case 43: // Make sure the compressor is in place. Do we need to do this?
            if (Look(5)==Compressor) {
                State = 50;
            }
            break;

        case 50: // Move to place the next Compressor/Robot Set
            if (MoveToNextCompressor(UseMasterCompressor)) {
                State = 51;
            }
            break;
        case 51: // We are at the location of our next Compressor.
            if (CurrentC == 0) {
                State = 5;
            } else {
                if (CurrentC < SizeX*SizeZ) {
                    if (SafeMove(5))
                        State = 40; // Place next robot/compressor set
                } else {
                    log_info("Pushing Voxels to Master Compressor");
                    State = 60; // Place Master or Empty into Master
                }
            }
            break;

       case 60: // Empty my self into the master
            if (PushMaster()) {
                if (BuildStairs && NextC==0)
                    State = 70;
                else
                    State = 80;
            }
            break;

        case 70: // Make stairs down next to the Master Compressor
            if (MiningLevel < StairsLevel) { // Only build stairs if we are mining below the already built stairs level
                log_info("Building Stair");
                if (SafeMove(0)) // Move away from the Master Compressor
                    State = 71;
            } else {
                State = 80;
            }
            break;
        case 71: // Move to the start of the stair
            if (MoveToStair())
                State = 72;
            break;
        case 72: // Build stair down to MiningLevel
            if (BuildStair()) {
                State = 80;
            }
            break;

        case 80: // Move to the first compressor
            CurrentC = NextC;
            NextC = 0;
            if (MoveToNextCompressor(0)) {
                State = 5;
            }
            break;

        case 100: // Done mining. Just some stuff to finish up.
            CurrentC = SizeX * SizeZ;
            MiningLevel = GetY();
            if (UseMasterCompressor)
                State = 101;
            else
                State = 105;
            break;
        case 101: // Return to the nearest "master"
            if (MoveToNextCompressor(1)) {
                log_info("Pushing Voxels to Master Compressor");
                State = 102;
                break;
            }
            break;
        case 102: // Empty me
            if (PushMaster()) {
                if (BuildStairs) {
                    log_info("Building Stair");
                    if (SafeMove(0)) // Move away from the Master Compressor
                        State = 103;
                } else {
                    State = 105;
                }
            }
            break;
        case 103: // Move to the start of the stair
            if (MoveToStair())
                State = 104;
            break;
        case 104: // Build at least one full rotation of the stair
            if (BuildStair()) {
                State = 105;
            }
            break;
        case 105: // Inform that we are done
            log_info("ALL WORK DONE!");
            State = 999;
            break;
        case 999: // Do nothing
            Time = Time + 60000;
            break;
    }
}

function MoveToNextCompressor(includeMaster)
{
    local x,y,z,v,d,destX,destY,destZ;
    if (CurrentC >= (SizeX * SizeZ + includeMaster))
        CurrentC = 0;
    if (CurrentC < SizeX*SizeZ) {
        x = CurrentC%SizeX;
        z = CurrentC/SizeX;
        if (z%2 > 0)
            x = (SizeX-1)-x;
        destZ = StartZ + z * MiningSize * 2 + x; // Offset every row of compressors by one for efficency
        destX = StartX + x * MiningSize * 2 - z;
        destY = MiningLevel;
    } else {
        if (UseMasterCompressor == 1) {
            destZ = StartZ - MiningSize;
            if (MasterLevel == UnknownReturn) {  // Search for nearest Master
                destX = StartX;
                if (destX == GetX() && destZ == GetZ()) {
                    if (Look(1) == Compressor) {
                        MasterLevel = GetY()-1;
                        destY = MasterLevel;
                    } else {
                        destY = GetY()-1;
                        if (destY > 1)
                          return 1;  // Failed to find a master compressor
                    }
                } else
                    destY = GetY();
            } else {
                if (((MasterLevel-NewMasterAfter) >= MiningLevel) && GetQuantity(Compressor) > 0) {
                    // If it is more then the set number of blocks up to the master and we still have Compressors in inventory place a new master.
                    MasterLevel = MiningLevel;
                    log_info("Setting new MasterLevel to "+MasterLevel);
                }
                destX = StartX + 1;
                destY = MasterLevel;
            }
        } else {
            log_err("Unexpected CurrentC "+CurrentC);
            return 0;
        }
    }
    if (destY>GetY()) {
        d = 4;  // Always move up first
    } else if (destX>GetX()) {
        d = 1;
    } else if (destX<GetX()) {
        d = 3;
    } else if (destZ>GetZ()) {
        d = 0;
    } else if (destZ<GetZ()) {
        d = 2;
    } else if (destY<GetY()) {
        d = 5; // and always down last
    } else {
        return 1;
    }
    log_file("Moving to Compressor "+CurrentC+" X:"+destX+" Y:"+destY+" Z:"+destZ+" Dir:"+d);
    if (!SafeMove(d)) {
        log_err("Could not move in direction "+d+". Area is probably not loaded.");
        Time = Time + 10000;
    }
    return 0;
}

function PushMaster()
{
    local i,j,v,b;
    b = 0;
    if (PathNo==2)
      b = GetLastBlackRock(); // If we build stair inside mining area we need to save one BlackRock type
    if (Look(5)==Compressor) {
        i = 0;
        j = 5000; // Limit how many voxels to push every Step.
        while (i<20 && j>0) {
            if (GetSlot_Quantity(i) > 0) {
                v = GetSlot_Type(i);
                if (v!=Compressor && v!=Robot && v!=b) {
                    PushVoxelTo(5,v);
                    j--;
                } else {
                    i++;
                }
            } else {
                i++;
            }
        }
        if (i >= 20) { // All Done
          return 1;
        }
    } else {
        if (GetQuantity(Compressor)>0) {
          log_info("Placeing Master Compressor");
          SafePickVoxel(5);
          PlaceVoxel(5,Compressor);
        } else {
           log_err("No Master Compressor found and no Atomic Compressor in inventory");
           Time = Time + 10000;
        }
    }
    return 0;
}

function IsStorageFull()
{
    local i;
    i = 0;
    while (GetSlot_Quantity(i) > 0 && i<20) {
      i++;
    }
    if (i>=20)
        return 1;
    return 0;
}

function MoveToStair()
{
    local d,destX,destY,destZ;

    if (BuildStairs==1) {
        destX = StartX + 2;
        destZ = StartZ - MiningSize - 2;
    } else {
        destX = StartX - 1;
        destZ = StartZ - MiningSize;
    }
    destY = StairsLevel;

    if (destX>GetX()) {
        d = 1;
    } else if (destX<GetX()) {
        d = 3;
    } else if (destY<GetY()) {
        d = 5;
    } else if (destY>GetY()) {
        d = 4;
    } else if (destZ>GetZ()) {
        d = 0;
    } else if (destZ<GetZ()) {
        d = 2;
    } else {
        if (BuildStairs==1)
          PathNo = 0;
        else
          PathNo = 2;
        Rotation = 0; // Always start from the beginning since we are only building full revolutions
        Step = 0;
        return 1;
    }
    log_file("Moving to start of stairs "+CurrentC+" X:"+destX+" Y:"+destY+" Z:"+destZ+" Dir:"+d);
    if (!SafeMove(d)) {
        log_err("Could not move in direction "+d+". Area is probably not loaded.");
        Time = Time + 10000;
    }
    return 0;
}

function BuildStair()
{
  local i,j,v,done;
  done = 0;
  do {
    // Check for end of path
    if (Step >= Path[PathNo].len())
    {
      Step = 0;
      Rotation = (Rotation+1)%4; // Next execution of path will be rotated one step clockwise.
      if (Rotation==0) { // One rotation done
        if (PathNo==0) {
          PathNo = 1; // Make doorway
          Rotation=3; // Only one rotation
        } else {
          StairsLevel = GetY();
          if (PathNo==1)
              PathNo = 0; // Reset PathNo to Stair
          if (StairsLevel <=  MiningLevel) // Continue until we are below of equal to the mining level
              return 1; // We are done. Let the caller know
        }
      }
    }
    i = Path[PathNo][Step];

    // Get direction part of path
    j = (i%8);
    if (j<4) // Don't rotate up/down
    {
      // Modify move/dig value with rotation
      j = (j+Rotation)%4;
    }

    v = Look(j);
    if ((i & 16)==16) { // Bit 8 set = Place Voxel
      if (GetVoxelProp(v,0)) { // If it is not a solid, place one.
        v = GetFirstBlackRock();
        if (v>0)
          PlaceVoxel(j,v);
      }
    } else {
      if (!GetVoxelProp(v,0)) // If it is a solid, mine it.
        SafePickVoxel(j);
    }
    if ((i & 8)==8) { // Bit 3 set = Move also
      if (!Move(j)) {
        log_err("Could not move while building stair! "+j);
      }
      done = 1;
    }
    Step++;
  } while (done==0)
  return 0; // Need to return but not really done yet
}

function GetFirstBlackRock()
{
  local a;
  for (a=1; a<=10; a++)
  {
      if(GetQuantity(a)>0)
      {
          return a;
      }
  }
  return 0;
}

function GetLastBlackRock()
{
  local a;
  for (a=10; a>=1; a--)
  {
      if(GetQuantity(a)>340)
      {
          return a;
      }
  }
  return 0;
}

function SafePickVoxel(dir)
{
    local v,b;
    v = Look(dir);
    if (v != Compressor && v != Robot) {
        b = GetVoxelProp(v,0)
        if (!b) { // If voxel is solid, pick it.
            return PickVoxel(dir);
        }
    } else {
      log_err("Oops. Almost picked a Compressor or Robot by mistake!");
      return 0;
    }
    return 1;
}

function SafeMove(dir)
{
    local v;
    if (SafePickVoxel(dir)) {
        v = Look(dir);
        if (v != 86 && v != 52) { // Avoid Green Acid and Lava
            return Move(dir);
        } else {
          log_err("Oops. Almost moved into Green Acid or Lava");
        }
    }
    return 0;
}

function log_file(msg)
{
    if (Debug>2) {
       error("Robot at " + GetX() + "," + GetY() + "," + GetZ() + " Info: " + msg+"\n");
    }
}

function log_info(msg)
{
    if (Debug>1) {
        Display( "Robot at " + GetX() + "," + GetY() + "," + GetZ() + " Info: " + msg, 1000, 4, 500);
        error("Robot at " + GetX() + "," + GetY() + "," + GetZ() + " Info: " + msg+"\n");
    }
}

function log_err(msg)
{
    if (Debug>0)
      Display( "ROBOT AT " + GetX() + "," + GetY() + "," + GetZ() + " Err: " + msg, 5000, 4, 2000);
    error("ROBOT AT " + GetX() + "," + GetY() + "," + GetZ() + " Err: " + msg+"\n");
    Time = Time + 2000;
}

34
Programming with Blackvoxel / Re: Simple mining bot restarter
« on: October 16, 2013, 05:23:47 pm »
I tried to make the script only do one operation for every Voxel_Step to make it as light weight CPU wise as possible. That was before I realized that Voxel_Step is only called 3.5 times a second for the programmable computer. I just assumed it was called once every frame.  I didn't yet know the limitation on how much you could do every step.

That piece of code is changed now.

But it still needs to keep track of how many robots is has in it's storage so it knows when the robots has finished dumping there storage into the compressor.


35
Gallery / Re: Qons gallery
« on: October 16, 2013, 03:17:40 pm »
You should not be afraid of using conveyor belts, they aren't that costly to make. It's the Materalizers/Dematerializers that are costly.

I like to build my factories visible. I want to see them working, it's part of the beauty.

I've never tried to transport water on conveyer belts. But everything about water is unreliable I think. Make a 2 block hole and put one water in it, and then put another water on top of that water, and they may both be moving back and forth in sync.

Still, really nice idea.

36
Programming with Blackvoxel / Re: Simple mining bot restarter
« on: October 16, 2013, 02:47:59 am »
Oh, sorry. Our script  ;)  Not sure there is even one single line left from the original thou.  :P

Well, the XRZ is impossible to get without cheating, and from the name "Extration Robot XR-TEST" in it's voxelinfo file I got the feeling it's never even supposed to be in the game.

Already the XR-2 robots are very costly to make. So I see this more as a way of using lots of XR-1 that are very easy to make. And since the Atomic Compressor is also really easy to make, the only thing complex you need to make is one single Programmable Robot, and you can have your self an small army. That's why I feel it may be to powerful. There is really no need to make any more advanced Robots. Seeing that the XR-2 is the robot that takes the longest of all Robots to mine it's designated area. I haven't done any exact measurements, but I got a feeling it's just 25% faster then the XR-1.

But with just 6 compressors and 24 XR-1, it still takes plenty of time to mine stuff.

So far I haven't run the script even once in my "real" play world.

The real work will come when you are going to build the fully automated factories to make all the parts needed to make your fully automated factories. All those Materialized/Dematerializers you will be needing takes forever to make.

Not much left to test in the script now. But it takes forever to run the tests. I wish there was a Robot that mined a much smaller area so it didn't take so long to run the tests.

37
Gallery / Re: Qons gallery
« on: October 16, 2013, 02:22:22 am »
Ok. So you sequence BlackRock Blues after the raw material to trigger another sequencer to send in the water?
I guess there are two parallel conveyer belts below the surface that both are 10 blocks long?

Nice Idea to use a Selective Mover before the Melting Furnace to send some stuff another way to start another sequencer. :)
And you take advantage off the fact that water and melted metal both fall, while the BlackRock Blues don't.

38
Programming with Blackvoxel / Re: Simple mining bot restarter
« on: October 15, 2013, 07:20:52 pm »
I did my test with 16*16 compressors and 1024 XR-Z, and the Computer have to move 33 voxels (+32 X and +1 Z) between placing every robots/compressors since the XR-Z mines an area of 16*64*16. The Computer also needs to move back up to empty it self into what I call a Master Compressor, and that will take longer and longer the further down you go. I've implemented a feature for it to place new Master Compressor every X levels (configurable). But it was able to place around 25-30 compressors before the first robots had finished.

Seems on Windows the game has 3*64 levels loaded below the player. Didn't really understand what Olive talked about changing how much is loaded, but he said that on windows you couldn't load any more then default. (But my BlackVoxel app only uses 1,5 GB of memory, so it still has room for another 2 GB if it is Large Address Aware.)
So if you don't go down with the computer, it will only mine down 3*64 levels. But you could just stand inside the area that is mined and you will follow it down.

I'm seriously beginning to think this script is to powerful. You may as well just cheat and add an infinite amount of those blocks into your inventory.

My script in action with 64 compressors and 256 XR-1 Robots.

39
Programming with Blackvoxel / Re: Simple mining bot restarter
« on: October 15, 2013, 02:08:54 am »
Yes, I have tried it with XRZ, but I didn't know they where mining 16 blocks wide instead of 8 as the XR-1 and XR-2 do.
But the XRZ is to fast the the script to keep up with.
I also tried how many compressors and robots it can handle. I tried 257 Compressors and 1024 robots. But it ran outside the loaded area already after 8 compressors in one direction. So I need to be standing in the middle for it to work with my 16*16 (256) compressors. Oh, and it also ran outside the Central Blue Plain, so the entire dig site was flooded with water.
I also noticed that digging a hole at location 0,0,0 is a very bad idea. If you die you end up in an infinite death loop.

The script builds in +X and +Z direction from where it start. Maybe I need to modify it so it builds equally in both + and - direction so your starting point is the center. Otherwise 8*8 is the practical limit. But even that is an impressive 64 compressors and 256 Robots.

For when it's done. Well, the complexity of a script always increases exponentially as factor of the number of lines it is. And I have still not found a way for it to save it's state. So it will not work after a load.

40
Programming with Blackvoxel / Re: Simple mining bot restarter
« on: October 15, 2013, 01:01:23 am »
30 minutes of running the script and I have some stuff in the Atomic Compressor at the edge on top.

41
Programming with Blackvoxel / Re: Simple mining bot restarter
« on: October 15, 2013, 12:54:19 am »
The Not so Simple Mining Bot Script is starting to take shape.

Maybe this is to powerful!!! The only limit to how many compressors+Robots it can handle is the limit of how large area of the world the game has loaded at any one time.

This is it running with 17 Atomic Compressors and 64 XR-1 Robots.

42
Gallery / Re: Pictures of my work area
« on: October 15, 2013, 12:49:47 am »
I can't use Water to cool of the molten metal when I create Stainless Steel. If I did I would get 7 Iron Bars, 2 Chrome Bars and one Nickel Bar instead of 10 Stainless Steel Bars.

43
Suggestions / Re: More Vehicles
« on: October 15, 2013, 12:46:57 am »
It's really difficult to use a plane as an elevator considering the extremely long starting and landing area it needs.

But the plane isn't actually that costly at all to build. It's just that you need to have Aluminum.

44
Suggestions / Re: The Sequencer
« on: October 15, 2013, 12:43:47 am »
Yea. Several levels of sequencers would be great.

45
Suggestions / Re: Metalurgy
« on: October 15, 2013, 12:37:32 am »
@Qon:
The Sequencer can feed to Melting Furnace so it produces molten metal, but it can't handle the already molted metal.
When you make Stainless Steel you need to melt 7 iron, 2 chrome and 1 nickel, and all those 10 blocks of molten metal needs to touch for the metallurgy to mix. If you cool the molten metal before they have all touched you will get unpredictable result like 4 iron ore and bunch of defected ally.

So the only sure way to automate it as it is now is to make a conveyer belt that holds as many molten metal that are needed to produce the correct metallurgy mix (for stainless steel that mean 10,20,30....) and put a Selective Mover at the end that only moves them of the conveyer belt once they have cooled of into Stainless Steel Bars. But this is a very slow way.

See my image for a working factory


Pages: 1 2 [3] 4 5