Documentation › Modules › Boat.em

File: Boat.em

Functions for manipulating Multi Boat objects.

Last modified: 08/31/2015

File Constants

const BOAT_SPEED_ONE_TILE 	:= 1;
const BOAT_SPEED_SLOW		:= 2;
const BOAT_SPEED_MEDIUM 	:= 3;
const BOAT_SPEED_FAST 		:= 4;

BoatFromItem( item )#

Parameters

item Item Ref

Explanation

if you have an itemref referring to a boat (typically in a doubleclick script) this will convert it into a boatref.
Note that this should not be necessary anymore.

Return values

Boat Reference

Errors

  • "Item wasn't a multi"
  • "Multi wasn't a boat"
  • "Invalid parameter type."

Related

MoveBoat( boat, facing, speed := BOAT_SPEED_ONE_TILE )#

Parameters

boat Boat Reference
facing Integer (0..7)
speed Integer (0..4)

Explanation

Moves a boat in the direction of an absolute facing
0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW
speed to determine how fast the boat movement should be animated for smooth move

Return values

1 on success, 0 on failure

Errors

  • none (returns 0 on invalid param)

Related

MoveBoatRelative( boat, direction, speed := BOAT_SPEED_ONE_TILE )#

Parameters

boat Boat Reference
direction Integer (0..7)
speed Integer (0..4)

Explanation

Move a boat in the direction of a relative facing. Same as MoveBoat, but adjusted for boat's facing.
If boat faces East, 0 will move E, 1 will move SE, etc.
speed to determine how fast the boat movement should be animated for smooth move

Return values

1 on success, 0 on failure

Errors

  • none (returns 0 on invalid param)

Related

MoveBoatXY( boat, x, y )#

Parameters

boat Boat Reference
x Integer world coordinate
y Integer world coordinate

Explanation

Moves a boat to the specified world coordinates.
Careful moving close to the world edge where a part of the boat might be out of bounds.

Return values

1 on success, 0 on failure

Errors

  • Invalid Parameter

Related

RegisterItemWithBoat( boat, item )#

Parameters

Explanation

'registering' an item with a boat causes the boat to move the item when it moves, if and only if the item is still on the boat.

Return values

1 always

Errors

  • none (returns 0 on invalid param)

Related

SystemFindBoatBySerial( serial )#

Parameters

serial Integer

Explanation

given the serial number of a boat, return a boatref that can be used with MoveBoat, TurnBoat, etc.
SystemFindObjectBySerial can find boats as well, should use that.

Return values

Boat Reference on success

Errors

  • "Boat not found."

Related

TurnBoat( boat, direction )#

Parameters

boat Boat Reference
direction Integer (0..3)

Explanation

Turn a boat in a direction, relative to its current directon.
direction is 0=none, 1=right, 2=flip, 3=left

Return values

true/false if the boat could be turned (i.e. wouldn't be in an invalid location after the turn)

Errors

  • "Invalid Parameter type"

Related