Hi There,
I have some expirience in C and Lua but this Squirrel language keeps me confused.
So this bit of code troubles me.
if(GetX() == (Start_X - DimX + 1) && NextRow){
PickVoxel(2);
Move(2);
NextRow = false;
Display( "I Should have moved", 5000, 2);
}
how can it be that the specific display text "I Should have moved" is shown but the Pick(2) and Move(2) is NOT executed.
This is the whole thig so far. The whole digging and movement will be replaced with loops. But first, i need to figure this problem out. As far as this code goes. It should check for a Storage device then go one down, two to the left and finaly one back. But i does not execute the last part ?
// Test
BotInit <- true; // X Y Z
Workmode <- false; // 0 = { 0, 0, 1 } = Front of the robot.
Start_X <- 0; // 1 = { 1, 0, 0 } = Right of the robot.
Start_Y <- 0; // 2 = { 0, 0, -1} = Back of the robot.
Start_Z <- 0; // 3 = {-1, 0, 0 } = Left of the robot.
MaxDepth <- -64; // 4 = { 0, 1, 0 } = Above the robot.
DimX <- 3; // 5 = { 0,-1, 0 } = Under the robot.
DimZ <- 3;
NextRow <- false;
function Voxel_Step(){
local VoxType;
if (BotInit == true){
VoxType = Look(0);
Start_X = GetX();
Start_Y = GetY();
Start_Z = GetZ();
if(VoxType == 49){
BotInit = false
Workmode = true;
PickVoxel(5);
Move(5);
}
else{
Display( "Error, no Storage Found at X = " + Start_X + " - Y " + Start_Y + " - Z " + Start_Z, 5000, 2);
}
}
if(Workmode == true){
if(GetX() > (Start_X - DimX + 1)){
PickVoxel(3);
Move(3);
NextRow = true;
}
if(GetX() == (Start_X - DimX + 1) && NextRow){
PickVoxel(2);
Move(2);
NextRow = false;
Display( "I Should have moved ", 5000, 2);
}
}
}
Thanks for your help.