System functions that provide information about a building and its contents, and allow you to control the building UI.
Unless otherwise stated, these functions refer to the building currently being accessed by the player. (This can be overriden using SetBuildingContext).
Format | sysGetBuyPrice( Item ) |
Description | Returns the 'Buy Price' set for this item in the currently accessed building |
Returns | 'Buy Price' of the item in denari |
Notes | Related commands: *setbuyprice [BuildingID] [Item] [Price] |
Example:
Event( "AccessBuilding", "2" )
{
$buyPrice = sysGetBuyPrice( "Flour" )
$buyPriceText = sysGetPriceText( $buyPrice )
osdcreate( OSDBUILDING, "BakeryOSD", "Bakery" )
osdadd( 200, 100, 200, 40, "Sell|Flour", "Buying flour ($buyPriceText)" )
osdactivate()
}
Format | sysGetSellPrice( Item_Name_or_Num ) |
Description | |
Returns | Price of the item in denari |
Example:
Event( "AccessBuilding", "12" )
{
osdcreate( OSDBUILDING, "Building", "Example" )
$woodSellPrice = sysGetSellPrice( "Wood" )
if ( $woodSellPrice == 0 )
{
osdadd( TEXT, 100, 100, 400, 0, "", "Not currently selling wood" )
}
else
{
$woodSellPriceText = sysGetPriceText( $woodSellPrice )
osdadd( TEXT, 100, 100, 400, 0, "", "Currently selling wood at $woodSellPriceText" )
}
osdactivate()
}
Format | sysGetEmployeeID( Index ) |
Description | Returns the employee player ID for the currently accessed building. Buildings can have up to 16 employees. |
Returns | PlayerID of the employee or 0 if none is set for this index |
Notes | Buildings currently have 16 possible slots for employees, index parameter is 0 - 15 |
Example:
Event( "AccessBuilding", "13" )
{
osdcreate( OSDBUILDING, "Building", "Example" )
$employeeID = sysGetEmployeeID( 0 )
if ( $employeeID != 0 )
{
$employeeName = sysGetPlayerName( $employeeID )
osdadd( TEXT, 100, 100, 400, 0, "", "Employee : $employeeName" )
}
else
{
osdadd( TEXT, 100, 100, 400, 0, "", "There is no-one currently employed at this building" )
}
osdactivate()
}
Various information the context building is provided through System Values - relevant ones are:
$gBuildingX, $gBuildingY : X,Y location of the building in map coords (default 0 → 255)
$gBuildingCode : Building type code - the number of the building type in the buildings editor list
$gBuildingNum, $gBuildingAccessNum : Unique ID number of the specific building being accessed
$gBuildingWorldX, $gBuildingWorldY : X,Y location of the building in world coords
$gBuildingTeam : Team the building belongs to (or 0 if none)
$gBuildingCapacity : Capacity value of the building (e.g. for homes)
$gBuildingSpaceRemaining : Remaining capacity of the building (e.g. for homes)
$gBuildingTown : Town building num of the town the building is in (or 0 if the building is not in a town)
$gBuildingScriptParam, , $gBuildingOwnerID, $gBuildingNumEmployees, $gBuildingMaxEmployees, $gBuildingSalePrice, $gBuildingWage, $gBuildingInvestment,
$gBuildingEfficiency, $gBuildingScore, $gBuildingType, $gBuildingDamage,