Simutrans-Squirrel-API
Functions
Tool interface

Functions

string do_work (player_x pl, coord3d start, coord3d end, int keys)
 
void mark_tiles (player_x pl, coord3d start, coord3d end, int keys)
 
string work (player_x pl, coord3d pos, int keys)
 

Detailed Description

The following methods are vital for the functioning of scripted tools. They will be called from simutrans to interact with the script. You should consider implementing them.

Function Documentation

◆ do_work()

string do_work ( player_x  pl,
coord3d  start,
coord3d  end,
int  keys 
)

Does the work (for tools of two-click type).

Returns
null upon success, an error message otherwise.
Parameters
plplayer instance to use this tool.
startfirst tile clicked by user.
endsecond tile clicked by user.
keysstate of ctrl/shift keys.

◆ mark_tiles()

void mark_tiles ( player_x  pl,
coord3d  start,
coord3d  end,
int  keys 
)

Mark tiles for working (for tools of two-click type). Call mark_tile from here.

Parameters
plplayer instance to use this tool.
startfirst tile clicked by user.
endsecond tile clicked by user.
keysstate of ctrl/shift keys.

◆ work()

string work ( player_x  pl,
coord3d  pos,
int  keys 
)

Does the work (for tools of one-click type).

Returns
null upon success, an error message otherwise.
Parameters
plplayer instance to use this tool.
postile clicked by user, here the work should be done.
keysstate of ctrl/shift keys.