SuperLib  _SuperLib_VERSION
 All Classes Functions
Static Public Member Functions | List of all members
_SuperLib_Helper Class Reference

Static Public Member Functions

static function GetOpenTTDVersion ()
 Get current OpenTTD version.
static function HasWorldGenBug ()
 Checks if the OpenTTD version that execute your script has the bug that APIs that perform a DoCommand (world modifying actions) will carry out the action, but return the same value as in test mode.
static function GetSuperLibVersion ()
static function PrintLibInfo (log_level=_SuperLib_Log.LVL_INFO)
static function Trim (string)
static function SplitString (delimiter, string, limit=null)
static function FindFromEnd (substr, string, startidx=null)
static function FindCharFromEnd (findchar, string, startidx=null)
static function GetCurrentDateString ()
static function GetDateString (date)
static function SetSign (tile, message, force_build_sign=false)
static function BreakPoint (sign_tile, force_break_point=false)
static function HasSign (text)
static function GetSign (text)
static function HasSignAt (tile)
static function GetSignAt (tile)
static function ClearAllSigns (except_tile=-1)
static function GetPAXCargo ()
static function GetMailCargo ()
static function GetCargoWithLargestAvailabilityInLargestTown (cargo_list)
static function GetTownProducedCargoList ()
static function GetTownAcceptedCargoList ()
static function ItemValuator (a)
static function Valuate (list, valuator,...)
 Apply a valuator function to every item of an AIList.
static function CallFunction (func, args)
 Call a function with the arguments given.
static function ListValueSum (ai_list)
static function CopyListSwapValuesAndItems (old_list)
static function GetListMinValue (ai_list)
static function GetListMaxValue (ai_list)
static function SquirrelListToAIList (squirrel_list)
static function ArrayFind (array, toFind)
static function Min (x1, x2)
static function Max (x1, x2)
static function Clamp (x, min, max)
static function Abs (a)

Member Function Documentation

function _SuperLib_Helper::CallFunction ( func  ,
args   
)
static

Call a function with the arguments given.

Parameters
funcThe function to call.
argsAn array with all arguments for func.
Precondition
args.len() <= 8.
Returns
The return value from the called function.
function _SuperLib_Helper::GetOpenTTDVersion ( )
static

Get current OpenTTD version.

Returns
A table with separate fields for each version part:
Note
that on RCs, IsRelease is false.
  • Major: the major version
  • Minor: the minor version
  • Build: the build
  • IsRelease: is this an stable release
  • Revision: the svn revision of this build
function _SuperLib_Helper::HasWorldGenBug ( )
static

Checks if the OpenTTD version that execute your script has the bug that APIs that perform a DoCommand (world modifying actions) will carry out the action, but return the same value as in test mode.

Eg. it will just return id 0 for all things that you create.

If this method returns true, you should call AIController.Sleep(1) to terminate world generation and start the game, before calling any API method that perform a DoCommand, and where you use the return value in any way.

This bug is further described here in the bug tracker: http://bugs.openttd.org/task/5561

function _SuperLib_Helper::Valuate ( list  ,
valuator  ,
  ... 
)
static

Apply a valuator function to every item of an AIList.

Parameters
listThe AIList to apply the valuator to.
valuatorThe function to apply.
othersExtra parameters for the valuator function).

The documentation for this class was generated from the following file: