Classes | Functions

Utils

Various utility functions to make life easier when working with FO2238. More...


Detailed Description

Various utility functions to make life easier when working with FO2238.

Include utils_h.fos for usage.

Classes

class  DateTime

Functions

string GetMsgStr (int textMsg, uint strNum)

Critter related

A list of functions that are more or less related to manipulating critters.



CritterAddNpc (Map@ map, uint16 pid, uint16 x, uint16 y, uint8 dir, uint dialogId, string& script, uint aiPack, uint bagId, uint teamId, bool isMob, uint level)
 AddNpc that is backwards compatible with old AddNpc function.
CritterAddNpc (Map@ map, uint16 pid, uint16 x, uint16 y, uint8 dir, uint dialogId, string& script, uint aiPack, uint bagId, uint teamId, uint factionRank, uint factionMode, bool isMob, uint level)
 AddNpc that is backwards compatible with old AddNpc function and provide additional faction info setting.
CritterAddNpc (Map@ map, uint16 pid, uint16 x, uint16 y, uint8 dir, array< int > params, uint dialogId, string& script, uint aiPack, uint bagId, uint teamId, bool isMob, uint level)
 AddNpc that is backwards compatible with old AddNpc function and override default parameters.
CritterAddNpc (Map@ map, uint16 pid, uint16 x, uint16 y, uint8 dir, array< int > params, uint dialogId, string& script, uint aiPack, uint bagId, uint teamId, uint factionRank, uint factionMode, bool isMob, uint level)
 AddNpc that is backwards compatible with old AddNpc function with additional faction data and override default parameters.
string GetCritterInfo (Critter& cr)
 Retrieve string with some critter information.
void AddScore (Critter@ cr, uint score, uint points)
 Add score to a critter.
bool ReloadWeapon (Critter& cr)
ItemGetRadio (Critter& cr)
 Retrieve radio that critter wears in a slot.
ItemGetRepairTool (Critter& cr)
 Retrieve tool that critter wears in a slot.
ItemGetEquippedItemByType (Critter& cr, uint ItemType)
 Retrieve an item of specified type (any weapon for example) that critter wears in a slot.
ItemGetEquippedItem (Critter& cr, uint Pid)
 Retrieve a specific item that critter wears in a slot.
ItemGetEquippedItem (Critter& cr, array< uint >& Pids)
 Retrieve any item in list that critter wears in a slot.
string GetConditionOfCritter (Critter@ cr)
 Gives string of player condition.
bool SkillRoll (Critter@ cr, int skill, int bonus)
 Does a skill roll.
int SkillCheck (Critter& cr, int skill, int skillused, Item@ item, int bonus)
 Useful wrapper for making checks if a proper skill or item was applied in a given context.
string SkillName (uint8 skill)
string GetExtConditionOfCritter (Critter@ cr)
 Gives string of extended player condition (animation).
bool AddExpTeam (Critter& critter, int xp)
 Function to add xp divided equally among all members of a "team".
void DropTimeouts (Critter& cr)
 Drop all timeouts of target critter.
void ClearEvents (Critter& cr)
 Clears all current critter events.
void GiveBag (uint bag, Critter@ cr)
 Create bag and add items to critter.
bool HasItem (Critter@ cr, uint pid)
bool HasSomeWeapon (Critter@ cr)
 Has a weapon in inventory or equipped.
uint GetBestWeaponSkill (Critter@ cr)
 Gets the best weapon skill that a critter has.
void AddOnlinePlayer (Critter& cr)
 Add player to array of all online players.
void RemoveOnlinePlayer (Critter& cr)
 Remove player from array of all online players.
uint GetAllOnlinePlayers (array< Critter@>& out players)
 Retrieve all players that are online.
uint GetNumberOfPlayersOnline ()
 Check how many players are online.
uint GetAuthenticatedPlayers (array< Critter@>& out players)
 Retrieve all authenticated players that are online.
uint GetAuthenticatedPlayers (array< Critter@>& out players, bool ignorePriviledges)
CritterGetMostSkilled (array< Critter@>@ group, int skill)
 Gets critter that is best at some skill in the group.
string GetAuthString (Critter& player)
 Retrieve a string showing target players access level.
string GetAuthString (int accesslevel)
 Retrieve a string showing target players access level.
bool CanRequestHelp (Critter& player)
 Check if target player can use +requesthelp.
void SetRequestedHelp (Critter& player)
 Disables the ability to use +requesthelp for some time.
void SetRequestedHelp (Critter& player, int minutes)
CritterGetOnlineGM ()
 Retrieve a random GM.
bool IsHumanoid (Critter@ cr)
void ClearEnemyStack (Critter& critter)
 Clear EnemyStack of target NPC.
void ClearEnemyStacksOnMap (Map@ map)
 Clear all EnemyStacks of all NPCs on specified map.
bool IsCurrentEnemy (Critter& cr, uint targetId)
 Checks if a target with given id is the critter's enemy, based on the enemy stack and attack planes.
stringGetSafePlayerName (uint id)
string GetSafePlayerName (uint id, string& onSuccess, string& onError)
uint GetGroupIndex (Critter& cr)
uint GetGroupIndex (int st)
void SetGroupIndex (Critter& cr, uint val)
 Modifies data responsible for holding faction/group index.
uint GetGroupRank (Critter& cr)
void SetGroupRank (Critter& cr, uint val)
uint GetGroupMode (Critter& cr)
void SetGroupMode (Critter& cr, uint val)
void SetGroupInfo (Critter& cr, uint faction, uint rank, uint mode)
void SetGroupInfoPack (Critter& cr, uint packInfo)

File handling and I/O

A list of functions that are related to reading/writing data from files.



bool ReadPids (array< int >& out pids, bool removeinvalid)
 Reads ITEMPID.H into supplied array.
void ReadDefines (string@ fileName, dictionary& items, array< string >@ defines)
 Read values defined in the given file.

String handling

A list of useful functions that are related to manipulating strings in various ways.



bool ParseDefine (const string& in line, string& out spid, int& out id)
 Gets info from line like this: define ITEM_PID number.
int SkipWhitespaces (const string& in str, int start)
 skips all whitespaces in string starting at start position
int SkipNonWhitespaces (const string& in str, int start)
 skips all non-whitespaces in string starting at start position
bool IsParameterTag (string& str)
 Checks if a string containers a parameter tag.
string GetParameterString (array< string@>@ arr, string& parameter)
 Gets the string of a named parameter in an array of strings.
int GetIndexOfString (array< string@>@ arr, string& str)
 Returns the index of a string in an array of strings.
string GetConcatenatedString (array< string@>@ arr, uint startindex, int stopindex)
 Concatenates the specified indexes of an array of strings to a string and returns it.

Locations and maps

A list of functions that are related to locations and maps.



void SetTurnBasedAvailability (Location@ loc)
 Sets turn based mode for all maps within the location.
bool IsEncounterMap (Map@ map)
 Checks if map is an encounter map.
bool IsTown (Map@ map)
 Checks if map is a town map.
uint GetMapType (Map@ map)
 Gets the type of a map.
LocationGetLocationOf (Critter& critter)
 Retrieve current location of a critter.
string GetLocationName (uint locId)
string GetLocationName (Location@ loc)

General functions

A list of functions that do various things.



void SetQuestGarbager (uint time, uint playerid, uint locid, uint var, uint val)
 Sets the time and event to garbage the location, setting a given variable to given value when the location was present on event execution.
void LockDoor (uint x, uint y, Map@ map, uint complexity, uint lockid)
 Lock a door.
void UnlockDoor (uint x, uint y, Map@ map)
 Unlock a door.
int gcd (int a, int b)
array< int > knapsack (array< int > weights, int W)

Time and dates

A list of functions related to time and dates.



IDateTimeGetCurrentDateTime ()
string GetCurrentDateTimeString ()
 Gets a DateTime string which displays both date and time.
string GetCurrentDateTimeString (bool date, bool time)
 Gets a DateTime string which displays date or/and time.

Containers

A list of functions related to working with containers.



ItemGetContainer (Map@ map, uint contpid, uint entire)
 Retrieve container from a map, with Entire.
bool TeleportCar (Item@ Car, uint MapId)
 Teleport a car to some other map.
void TransferItemsToContOnMap (Critter& cr, Map@ map, int entid, int contpid, int itemtypes)
 Transfer some items from target critter to a container on a specific map via Entire.
void TransferItemsFromContOnMap (Critter& cr, Map@ map, int entid, int contpid)
 Transfer items from a container to a critter.
void ClearContainer (Item@ container)
 Deletes all items in specified container.
void MoveItemsCritterToCont (Critter& crFrom, Item& contTo, uint specid)
 Move all items from a critter to a subcontainer of a container.

Variables

A list of functions related to working with game variables.



int GetGvar (uint gvar)
 Wrapper function for retrieving the value of a GVAR (Global variable).
void SetGvar (uint gvar, uint value)
 Wrapper function for setting the value of a GVAR (Global variable).
int GetLLvar (Location& location, uint llvar)
int GetLLvar (uint locationId, uint llvar)
void SetLLvar (Location& location, uint llvar, uint value)
int GetLMvar (Map& map, uint lmvar)
int GetLMvar (uint mapId, uint lmvar)
void SetLMvar (Map& map, uint lmvar, uint value)
int GetLIvar (Item& item, uint livar)
int GetLIvar (uint itemId, uint livar)
void SetLIvar (Item& item, uint livar, uint value)
int GetLvar (Critter& critter, uint lvar)
 Wrapper function for retrieving the value of an LVAR (Local variable) from a critter.
int GetLvar (uint id, uint lvar)
 Wrapper function for retrieving the value of an LVAR (Local variable) from a critter.
int GetLvar (uint id, uint lvar, string& typeShort)
void SetLvar (Critter& critter, uint lvar, uint value)
 Wrapper function for setting the value of an LVAR (Local variable).
void SetLvar (uint id, uint lvar, uint value)
 Wrapper function for setting the value of an LVAR (Local variable).
void SetLvar (uint id, uint lvar, uint value, string& typeShort, string& typeLong)
int GetUvar (uint uvar, uint masterid, uint slaveid)
 Wrapper function for retrieving the value of an UVAR ("Unicum" variable).
void SetUvar (uint uvar, uint masterid, uint slaveid, uint value)
 Wrapper function for setting the value of an UVAR ("Unicum" variable).

Item Value

A list of functions related to retrieving the value of various items.



uint GetContainerValue (Item@ container)
 Uses BaseItemValue to deduce value of all items in a container.
uint BaseItemValue (uint pid, bool ammo)
 base value of an spawned item with this pid (with 0% deterioration, unbroken)
uint BaseItemValue (uint pid, uint broken, uint det, bool ammo)
 base value of an spawned item with this pid (with det% deterioration, broken times broken)
uint BaseItemValue (Item@ item)
 Full base value of an item, count included.
uint BaseItemValue (Item@ item, uint proc)
 proc% of base value of an item (ammo value is always 100%), count included
uint BaseSingleItemValue (Item@ item)
 full base value of an item, count NOT included.
uint BaseSingleItemValue (Item@ item, uint proc)
 proc% of base value of an item (ammo value is always 100%), count NOT included
bool Pickable (Item@ item)

Function Documentation

Critter@ AddNpc ( Map map,
uint16  pid,
uint16  x,
uint16  y,
uint8  dir,
uint  dialogId,
string script,
uint  aiPack,
uint  bagId,
uint  teamId,
bool  isMob,
uint  level 
)

AddNpc that is backwards compatible with old AddNpc function.

Parameters:
map Map handle where NPC should be spawned.
pid PID of NPC to spawn.
x X-position on map.
y Y-position on map.
dir direction of NPC, see direction defines in _defines.fos
dialogId dialog id, see dialogs.lst or _dialogs.fos
script script module and init function to use, for example: "guard@critter_init", means use the function critter_init in script guard.fos
aiPack AI pack to assign to NPC. See _ai.fos
bagId Bag to assign to NPC. See BAGS.txt
teamId Assign Faction/Team.
isMob Deprecated parameter, used only in some really old code. Set it to false.
level Level of spawned NPC.
Returns:
Handle to the spawned NPC, if AddNpc failed, it's null.
Critter@ AddNpc ( Map map,
uint16  pid,
uint16  x,
uint16  y,
uint8  dir,
uint  dialogId,
string script,
uint  aiPack,
uint  bagId,
uint  teamId,
uint  factionRank,
uint  factionMode,
bool  isMob,
uint  level 
)

AddNpc that is backwards compatible with old AddNpc function and provide additional faction info setting.

Parameters:
map Map handle where NPC should be spawned.
pid PID of NPC to spawn.
x X-position on map.
y Y-position on map.
dir direction of NPC, see direction defines in _defines.fos
dialogId dialog id, see dialogs.lst or _dialogs.fos
script script module and init function to use, for example: "guard@critter_init", means use the function critter_init in script guard.fos
aiPack AI pack to assign to NPC. See _ai.fos
bagId Bag to assign to NPC. See BAGS.txt
teamId Assign Faction/Team.
factionRank Assign Faction/Team rank.
factionMode Assign Faction/Team mode.
isMob Deprecated parameter, used only in some really old code. Set it to false.
level Level of spawned NPC.
Returns:
Handle to the spawned NPC, if AddNpc failed, it's null.
Critter@ AddNpc ( Map map,
uint16  pid,
uint16  x,
uint16  y,
uint8  dir,
array< int >  params,
uint  dialogId,
string script,
uint  aiPack,
uint  bagId,
uint  teamId,
bool  isMob,
uint  level 
)

AddNpc that is backwards compatible with old AddNpc function and override default parameters.

Parameters:
map Map handle where NPC should be spawned.
pid PID of NPC to spawn.
x X-position on map.
y Y-position on map.
dir direction of NPC, see direction defines in _defines.fos
params override for default parameters
dialogId dialog id, see dialogs.lst or _dialogs.fos
script script module and init function to use, for example: "guard@critter_init", means use the function critter_init in script guard.fos
aiPack AI pack to assign to NPC. See _ai.fos
bagId Bag to assign to NPC. See BAGS.txt
teamId Assign Faction/Team.
isMob Deprecated parameter, used only in some really old code. Set it to false.
level Level of spawned NPC.
Returns:
Handle to the spawned NPC, if AddNpc failed, it's null.
Critter@ AddNpc ( Map map,
uint16  pid,
uint16  x,
uint16  y,
uint8  dir,
array< int >  params,
uint  dialogId,
string script,
uint  aiPack,
uint  bagId,
uint  teamId,
uint  factionRank,
uint  factionMode,
bool  isMob,
uint  level 
)

AddNpc that is backwards compatible with old AddNpc function with additional faction data and override default parameters.

Parameters:
map Map handle where NPC should be spawned.
pid PID of NPC to spawn.
x X-position on map.
y Y-position on map.
dir direction of NPC, see direction defines in _defines.fos
params override for default parameters
dialogId dialog id, see dialogs.lst or _dialogs.fos
script script module and init function to use, for example: "guard@critter_init", means use the function critter_init in script guard.fos
aiPack AI pack to assign to NPC. See _ai.fos
bagId Bag to assign to NPC. See BAGS.txt
teamId Assign Faction/Team.
isMob Deprecated parameter, used only in some really old code. Set it to false.
level Level of spawned NPC.
Returns:
Handle to the spawned NPC, if AddNpc failed, it's null.
string GetCritterInfo ( Critter cr  ) 

Retrieve string with some critter information.

Suitable for usage in logging.

void AddScore ( Critter cr,
uint  score,
uint  points 
)

Add score to a critter.

Parameters:
cr Critter handle.
score Score index.
points How many points to add.
bool ReloadWeapon ( Critter cr  ) 
Item@ GetRadio ( Critter cr  ) 

Retrieve radio that critter wears in a slot.

Parameters:
cr Critter handle.
Returns:
Item handle to found radio, or null if none is carried in slots.
Item@ GetRepairTool ( Critter cr  ) 

Retrieve tool that critter wears in a slot.

Parameters:
cr Critter handle.
Returns:
Item handle to found tool, or null if none is carried in slots.
Item@ GetEquippedItemByType ( Critter cr,
uint  ItemType 
)

Retrieve an item of specified type (any weapon for example) that critter wears in a slot.

Parameters:
cr Critter handle.
ItemType Item type to search for.
Returns:
Item handle to found item, or null if none is carried in slots.
Item@ GetEquippedItem ( Critter cr,
uint  Pid 
)

Retrieve a specific item that critter wears in a slot.

Parameters:
cr Critter handle.
Pid Item PID to search for.
Returns:
Item handle to found item, or null if none is carried in slots.
Item@ GetEquippedItem ( Critter cr,
array< uint >&  Pids 
)

Retrieve any item in list that critter wears in a slot.

Parameters:
cr Critter handle.
Pids List of item PIDs to search for.
Returns:
Item handle to found item, or null if none is carried in slots.
string GetConditionOfCritter ( Critter cr  ) 

Gives string of player condition.

Parameters:
cr Handle to critter.
Returns:
If not valid critter or condition couldn't be converted, returns "", else it returns condition in string form.
bool SkillRoll ( Critter cr,
int  skill,
int  bonus 
)

Does a skill roll.

Parameters:
cr Handle to critter.
skill Skill number
bonus Skill bonus
Returns:
True is passed, false otherwise
int SkillCheck ( Critter cr,
int  skill,
int  skillused,
Item item,
int  bonus 
)

Useful wrapper for making checks if a proper skill or item was applied in a given context.

Parameters:
cr Critter reference.
skill Skill number to be checked
skillused Skill that is supposed to be used - if used item implied skill or used skill do not match, the function fails
item Item handle, might imply used skill, e.g. Lockpicks imply SK_LOCKPICK
bonus Skill bonus
Returns:
SKILL_CHECK_DOES_NOTHING if the skill used and wanted/implied by item do not match. Otherwise, result of the skill roll, either SKILL_CHECK_FAILURE or SKILL_CHECK_SUCCESS
string SkillName ( uint8  skill  ) 
string GetExtConditionOfCritter ( Critter cr  ) 

Gives string of extended player condition (animation).

Parameters:
cr Handle to critter.
Returns:
If not valid critter or condition couldn't be converted, returns "", else it returns condition in string form.
Remarks:
This will only work if condition of critter is either COND_KNOCKOUT or COND_DEAD as only those use ExtCondition.
bool AddExpTeam ( Critter critter,
int  xp 
)

Function to add xp divided equally among all members of a "team".

Parameters:
critter Handle to one member of a team.
xp Amount of total XP points to add.
Remarks:
A team is currently defined as everyone that has arrowed the leader. If leader is invalid, all the xp will be added to the specified critter.
Returns:
If leader is valid, true, otherwise false.
void DropTimeouts ( Critter cr  ) 

Drop all timeouts of target critter.

Parameters:
cr Critter handle.
void ClearEvents ( Critter cr  ) 

Clears all current critter events.

Parameters:
cr Critter handle.
void GiveBag ( uint  bag,
Critter cr 
)

Create bag and add items to critter.

Parameters:
cr Critter handle.
bag Bag Id to give.
bool HasItem ( Critter cr,
uint  pid 
)
bool HasSomeWeapon ( Critter cr  ) 

Has a weapon in inventory or equipped.

uint GetBestWeaponSkill ( Critter cr  ) 

Gets the best weapon skill that a critter has.

Parameters:
cr Handle to critter.
Returns:
The best weapon skill the critter has. See _defines.fos and the SK_* entries for relevant skills.
void AddOnlinePlayer ( Critter cr  ) 

Add player to array of all online players.

Parameters:
cr Handle to critter.
void RemoveOnlinePlayer ( Critter cr  ) 

Remove player from array of all online players.

Parameters:
cr Handle to critter.
uint GetAllOnlinePlayers ( array< Critter@>& out  players  ) 

Retrieve all players that are online.

Parameters:
players Array to store player handles in.
Returns:
Number of players online.
uint GetNumberOfPlayersOnline (  ) 

Check how many players are online.

Returns:
Number of players online.
uint GetAuthenticatedPlayers ( array< Critter@>& out  players  ) 

Retrieve all authenticated players that are online.

Parameters:
players Array to store player handles in.
Remarks:
Some admins may be hidden and won't show up here.
Returns:
Number of authenticated players.
uint GetAuthenticatedPlayers ( array< Critter@>& out  players,
bool  ignorePriviledges 
)
Critter@ GetMostSkilled ( array< Critter@>@  group,
int  skill 
)

Gets critter that is best at some skill in the group.

Parameters:
group A group of critters.
skill Which skill. See _defines.fos for a list of skills. (SK_*)
Returns:
Handle to most skilled critter.
string GetAuthString ( Critter player  ) 

Retrieve a string showing target players access level.

Parameters:
player Target player.
Returns:
A string showing target players access level.
Remarks:
Possible results are: "Client", "Tester", "GM" and "Admin"
string GetAuthString ( int  accesslevel  ) 

Retrieve a string showing target players access level.

Parameters:
accesslevel Access number.
Returns:
A string showing target players access level.
Remarks:
Possible results are: "Client", "Tester", "GM" and "Admin"
bool CanRequestHelp ( Critter player  ) 

Check if target player can use +requesthelp.

Parameters:
player Target player.
void SetRequestedHelp ( Critter player  ) 

Disables the ability to use +requesthelp for some time.

Parameters:
player Target player.
void SetRequestedHelp ( Critter player,
int  minutes 
)
Critter@ GetOnlineGM (  ) 

Retrieve a random GM.

If none is found, any authenticated (Admin) is picked.

Returns:
Handle of found GM/admin. Null if none is online.
bool IsHumanoid ( Critter cr  ) 
void ClearEnemyStack ( Critter critter  ) 

Clear EnemyStack of target NPC.

Parameters:
critter Target NPC.
Remarks:
The EnemyStack is an array/memory filled with ids of hostile critters.
void ClearEnemyStacksOnMap ( Map map  ) 

Clear all EnemyStacks of all NPCs on specified map.

Parameters:
map Target Map.
Remarks:
The EnemyStack is an array/memory filled with ids of hostile critters.
bool IsCurrentEnemy ( Critter cr,
uint  targetId 
)

Checks if a target with given id is the critter's enemy, based on the enemy stack and attack planes.

string@ GetSafePlayerName ( uint  id  ) 
string GetSafePlayerName ( uint  id,
string onSuccess,
string onError 
)
uint GetGroupIndex ( Critter cr  ) 
uint GetGroupIndex ( int  st  ) 
void SetGroupIndex ( Critter cr,
uint  val 
)

Modifies data responsible for holding faction/group index.

uint GetGroupRank ( Critter cr  ) 
void SetGroupRank ( Critter cr,
uint  val 
)
uint GetGroupMode ( Critter cr  ) 
void SetGroupMode ( Critter cr,
uint  val 
)
void SetGroupInfo ( Critter cr,
uint  faction,
uint  rank,
uint  mode 
)
void SetGroupInfoPack ( Critter cr,
uint  packInfo 
)
bool ReadPids ( array< int >& out  pids,
bool  removeinvalid 
)

Reads ITEMPID.H into supplied array.

Parameters:
pids Array to store read pids in.
removeinvalid Remove PIDs not used in the game.
Returns:
If file is found and parsed successfully, true, else false.
void ReadDefines ( string fileName,
dictionary items,
array< string >@  defines 
)

Read values defined in the given file.

Parameters:
fileName Name of the file to read defines from. Relative path from the server application can be used.
items A dictionary to which the defines will be read into, the key is in string format, while the dictionary value is the define value.
defines A string array to which the defines will be read into.
bool ParseDefine ( const string& in  line,
string& out  spid,
int& out  id 
)

Gets info from line like this: define ITEM_PID number.

Parameters:
line A define line, example: "#define PID_ROCK (19)".
spid The parsed string will be stored in this variable.
id The parsed number will be stored in this variable.
Returns:
True when succeeded, false otherwise
int SkipWhitespaces ( const string& in  str,
int  start 
)

skips all whitespaces in string starting at start position

Parameters:
str The string used.
start The position in the string to start at.
Returns:
index of first non-whitespace character from start.
int SkipNonWhitespaces ( const string& in  str,
int  start 
)

skips all non-whitespaces in string starting at start position

Parameters:
str The string used.
start The position in the string to start at.
Returns:
index of first whitespace character
bool IsParameterTag ( string str  ) 

Checks if a string containers a parameter tag.

Example: "-dir 0"

Parameters:
str The string used.
Returns:
True if it contains any of the possible tags that can be used, false if not.
Remarks:
The following tags are valid:"-dir", "-full", "-dist" ,"-role" , "-min" ,"-max", "-v1" ,"-v2" ,"-v3" ,"-v4" ,"-v5", "-script" ,"-dmg" ,"-pid". Besides these, any character combined with - can be used, for example: "-b".
string GetParameterString ( array< string@>@  arr,
string parameter 
)

Gets the string of a named parameter in an array of strings.

Parameters:
arr An array of strings (a sentance for example).
parameter The parameter tag to use. See IsParameterTag for more information.
Returns:
A string with the parameter tag's information. Example: `whisper -p Lord Cektop -m Prepare to die! The parameter "-m" would in this case return "Prepare to die!"
int GetIndexOfString ( array< string@>@  arr,
string str 
)

Returns the index of a string in an array of strings.

Parameters:
arr The array of strings to search.
str The string to look for.
Returns:
If not found, it returns -1, else it returns the index of the string in the array.
string GetConcatenatedString ( array< string@>@  arr,
uint  startindex,
int  stopindex 
)

Concatenates the specified indexes of an array of strings to a string and returns it.

Parameters:
startindex Which index in the array to start at.
stopindex Which index in the array to stop at, if stopindex = -1 it means that it will run until the end of the array.
Returns:
The concatenated string.
string GetMsgStr ( int  textMsg,
uint  strNum 
)
void SetTurnBasedAvailability ( Location loc  ) 

Sets turn based mode for all maps within the location.

Parameters:
loc Location handle.
bool IsEncounterMap ( Map map  ) 

Checks if map is an encounter map.

Parameters:
map Map handle.
Returns:
True if map is an encounter map, otherwise false.
bool IsTown ( Map map  ) 

Checks if map is a town map.

Parameters:
map Map handle.
Returns:
True if map is a town map, otherwise false.
uint GetMapType ( Map map  ) 

Gets the type of a map.

Parameters:
map Map handle.
Returns:
Type of the map, see utils_h.fos for a list of different types.
Location@ GetLocationOf ( Critter critter  ) 

Retrieve current location of a critter.

Parameters:
critter Critter handle.
Returns:
Handle to the critter's location, null will be returned if the critter is on the worldmap or if there's some error.
string GetLocationName ( uint  locId  ) 
string GetLocationName ( Location loc  ) 
void SetQuestGarbager ( uint  time,
uint  playerid,
uint  locid,
uint  var,
uint  val 
)

Sets the time and event to garbage the location, setting a given variable to given value when the location was present on event execution.

Parameters:
time Time to garbage, in real minutes, if 0 then default is taken
playerid Id of the player, the location owner
locid Id of the location
var Variable number to be set
val Value for the variable
void LockDoor ( uint  x,
uint  y,
Map map,
uint  complexity,
uint  lockid 
)

Lock a door.

Parameters:
x X-position on map.
y Y-position on map.
map Map handle.
complexity Lock complexity.
lockid Id of the lock to use. The Id corresponds to the key that is needed to open the door.
void UnlockDoor ( uint  x,
uint  y,
Map map 
)

Unlock a door.

Parameters:
x X-position on map.
y Y-position on map.
map Map handle.
int gcd ( int  a,
int  b 
)
array<int> knapsack ( array< int >  weights,
int  W 
)
IDateTime@ GetCurrentDateTime (  ) 
string GetCurrentDateTimeString (  ) 

Gets a DateTime string which displays both date and time.

Parameters:
map Target Map.
Returns:
Current DateTime string which displays both date and time.
string GetCurrentDateTimeString ( bool  date,
bool  time 
)

Gets a DateTime string which displays date or/and time.

Parameters:
date Display date.
time Display time.
Returns:
Current DateTime string with specified options.
Item@ GetContainer ( Map map,
uint  contpid,
uint  entire 
)

Retrieve container from a map, with Entire.

Parameters:
map Map handle.
contpid Itempid of the container to retrieve.
entire Which Entire to use for coordinates of the container (Entire has to be placed on the same hex as container in mapper)
Returns:
Item handle of the found container. If map is invalid or container not found, null.
bool TeleportCar ( Item Car,
uint  MapId 
)

Teleport a car to some other map.

Returns:
False if no free spot for the vehicle is found
void TransferItemsToContOnMap ( Critter cr,
Map map,
int  entid,
int  contpid,
int  itemtypes 
)

Transfer some items from target critter to a container on a specific map via Entire.

Parameters:
map Map handle.
cr Critter handle.
contpid Itempid of the container to transfer to.
entid Which Entire to use for coordinates of the container (Entire has to be placed on the same hex as container in mapper)
itemtypes Type of items to transfer from critter. ITEMTRANSFER_ALL or ITEMTRANSFER_WEAPONS is valid.
void TransferItemsFromContOnMap ( Critter cr,
Map map,
int  entid,
int  contpid 
)

Transfer items from a container to a critter.

Parameters:
map Map handle.
cr Critter handle.
contpid Itempid of the container to transfer from.
entid Which Entire to use for coordinates of the container (Entire has to be placed on the same hex as container in mapper)
void ClearContainer ( Item container  ) 

Deletes all items in specified container.

Parameters:
container Handle to target container.
void MoveItemsCritterToCont ( Critter crFrom,
Item contTo,
uint  specid 
)

Move all items from a critter to a subcontainer of a container.

Parameters:
crFrom The critter which items are moved from.
contTo Target container.
specid Special Id of subcontainer, if 0, critter's Id is used.
int GetGvar ( uint  gvar  ) 

Wrapper function for retrieving the value of a GVAR (Global variable).

Parameters:
gvar Target GVAR.
Returns:
Value of the specified GVAR.
void SetGvar ( uint  gvar,
uint  value 
)

Wrapper function for setting the value of a GVAR (Global variable).

Parameters:
gvar Target GVAR.
value Value to set.
int GetLLvar ( Location location,
uint  llvar 
)
int GetLLvar ( uint  locationId,
uint  llvar 
)
void SetLLvar ( Location location,
uint  llvar,
uint  value 
)
int GetLMvar ( Map map,
uint  lmvar 
)
int GetLMvar ( uint  mapId,
uint  lmvar 
)
void SetLMvar ( Map map,
uint  lmvar,
uint  value 
)
int GetLIvar ( Item item,
uint  livar 
)
int GetLIvar ( uint  itemId,
uint  livar 
)
void SetLIvar ( Item item,
uint  livar,
uint  value 
)
int GetLvar ( Critter critter,
uint  lvar 
)

Wrapper function for retrieving the value of an LVAR (Local variable) from a critter.

Parameters:
critter Critter handle.
lvar LVAR to check.
Returns:
Value of the specified LVAR.
int GetLvar ( uint  id,
uint  lvar 
)

Wrapper function for retrieving the value of an LVAR (Local variable) from a critter.

Parameters:
id Critter Id.
lvar LVAR to check.
Returns:
Value of the specified LVAR.
int GetLvar ( uint  id,
uint  lvar,
string typeShort 
)
void SetLvar ( Critter critter,
uint  lvar,
uint  value 
)

Wrapper function for setting the value of an LVAR (Local variable).

Parameters:
critter Critter handle.
lvar Target LVAR.
value Value to set.
void SetLvar ( uint  id,
uint  lvar,
uint  value 
)

Wrapper function for setting the value of an LVAR (Local variable).

Parameters:
id Critter Id.
lvar Target LVAR.
value Value to set.
void SetLvar ( uint  id,
uint  lvar,
uint  value,
string typeShort,
string typeLong 
)
int GetUvar ( uint  uvar,
uint  masterid,
uint  slaveid 
)

Wrapper function for retrieving the value of an UVAR ("Unicum" variable).

Parameters:
uvar Target UVAR.
masterid MasterId corresponding to some critter.
slaveid SlaveId corresponding to another critter.
Returns:
Value of the UVAR.
void SetUvar ( uint  uvar,
uint  masterid,
uint  slaveid,
uint  value 
)

Wrapper function for setting the value of an UVAR ("Unicum" variable).

Parameters:
uvar Target UVAR.
masterid MasterId corresponding to some critter.
slaveid SlaveId corresponding to another critter.
value Value of the UVAR to set.
uint GetContainerValue ( Item container  ) 

Uses BaseItemValue to deduce value of all items in a container.

Parameters:
container Target container.
Returns:
value Total value of all items in the container.
uint BaseItemValue ( uint  pid,
bool  ammo 
)

base value of an spawned item with this pid (with 0% deterioration, unbroken)

Parameters:
pid Pid of an item.
ammo Is it ammo?
Returns:
Base value of the item.
uint BaseItemValue ( uint  pid,
uint  broken,
uint  det,
bool  ammo 
)

base value of an spawned item with this pid (with det% deterioration, broken times broken)

Parameters:
pid Pid of an item.
ammo Is it ammo?
broken How many times the item was broken.
det % deterioration.
Returns:
Base value of the item.
uint BaseItemValue ( Item item  ) 

Full base value of an item, count included.

Parameters:
item Item handle.
Returns:
Base value of the item.
uint BaseItemValue ( Item item,
uint  proc 
)

proc% of base value of an item (ammo value is always 100%), count included

Parameters:
item Item handle.
proc Percentage of base value.
Returns:
Calculated value.
uint BaseSingleItemValue ( Item item  ) 

full base value of an item, count NOT included.

Parameters:
item Item handle.
Returns:
Base value of item.
uint BaseSingleItemValue ( Item item,
uint  proc 
)

proc% of base value of an item (ammo value is always 100%), count NOT included

Parameters:
item Item handle.
proc Percentage of value.
Returns:
Calculated value of item.
bool Pickable ( Item item  )