Problem with "while" statement.
Posted: 23 Feb 2014, 16:12
Hey, I'm working on a mini-game, and at a point it checks the whole map and says how much Block.air there is:
(For some reason MCDzienny doesn't have pos.y at this part)
And when the game starts the underground starts filling with lava, when it does completely the air count is 125, (because of the spawn area) so I run the following code:
But it won't actually run the code (I made a seperate command to make sure the value is 125).
Did I do something completely stupid?
- Code: Select all
byte b1;
b1 = Block.air;
ushort x2, y2, z2; int currentBlock = 0;
List<MCDzienny.Level.Pos> stored = new List<MCDzienny.Level.Pos>(); MCDzienny.Level.Pos pos;
foreach (byte b in p.level.blocks)
{
if (b == b1)
{
p.level.IntToPos(currentBlock, out x2, out y2, out z2);
pos.x = x2;
pos.z = z2;
stored.Add(pos);
}
currentBlock++;
}
(For some reason MCDzienny doesn't have pos.y at this part)
And when the game starts the underground starts filling with lava, when it does completely the air count is 125, (because of the spawn area) so I run the following code:
- Code: Select all
while (gameactive)
{
if (stored.Count == 125)
{
gameactive = false;
Player.GlobalMessage("The current Digger game has ended.");
return;
}
}
But it won't actually run the code (I made a seperate command to make sure the value is 125).
Did I do something completely stupid?