Crab.waitForBlock()

From 8x9craft
Revision as of 06:23, 24 March 2017 by Maciek (talk | contribs) (Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
function waitForBlock(): Vector3i

Make the crab wait until a block has been changed around it. That includes blocks in front, behind, to the left, to the right, above and below the crab.

Returns: an object of type Vector3i containing the position of the block that has changed.

Examples

// Wait for a block to change.
while (!crab.isBlocked()) {
    crab.forward();
}
var pos = crab.waitForBlock();
var forward = crab.getPosition().offset(crab.getFacing());
if (pos == forward) {
    crab.say('A block in the front has changed');
}

See also

Navigation menu

Internal error

Jump to: navigation, search
[35e74cfa2a2248cc8f0ad3e6] 2024-03-29 14:06:38: Fatal exception of type "Error"

Navigation menu