scripting:reference:system_functions:buildinginformationfunctions
This is an old revision of the document!
Table of Contents
Building Information Functions
System functions that provide information about a building and its contents, and allow you to control the building UI.
sysAmountInStocks
Format | sysAmountInStocks( [Item_Name or Num] ) |
---|---|
Description | Returns the amount of the item currently in the building's stocks |
Parameters | Item Name or number |
Example | $amountInBuilding = sysAmountInStocks(“Wood”) |
sysMaxAmountInStocks
Format | sysMaxAmountInStocks ( [Item_Name or Num] ) |
---|---|
Description | Returns the maximum amount of the item currently allowed in the building's stocks. (This value is set in the building editor tool, or can be manually lowered by the building owner) |
Parameters | Item Name or number |
Example | $maxAmountInBuilding = sysMaxAmountInStocks(“Wood”) |
sysGetBuyPrice
Format | sysGetBuyPrice [Item] ) |
---|---|
Description | Returns the 'Buy Price' set for this item in the currently accessed building |
Parameters | Item name or number |
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" ) osdaddat( 200, 100, 200, 40, "Sell|Flour", "Buying flour ($buyPriceText)" ) osdactivate() }
sysGetSellPrice
Format | sysGetSellPrice( [Item_Name or Num] ) |
---|---|
Description | Returns the price that the item is currently set for sale at (Or 0 if it is not currently for sale) |
Parameters | Item Name or number |
Example:
Event( "AccessBuilding", "12" ) { osdcreate( OSDBUILDING, "Building", "Example" ) $woodSellPrice = sysGetSellPrice( "Wood" ) if ( $woodSellPrice == 0 ) { osdaddat( TEXT, 100, 100, 400, 0, "", "Not currently selling wood" ) } else { $woodSellPriceText = sysGetPriceText( $woodSellPrice ) osdaddat( TEXT, 100, 100, 400, 0, "", "Currently selling wood at $woodSellPriceText" ) } osdactivate() }
sysGetEmployeeID
Format | sysGetEmployeeID( [Index] ) |
---|---|
Description | Returns the employee player ID for the currently accessed building. Buildings can have up to 16 employees. |
Parameters | Index (0 - 15) |
Returns | PlayerID of the employee or 0 if none is set for this index |
Example:
Event( "AccessBuilding", "13" ) { osdcreate( OSDBUILDING, "Building", "Example" ) $employeeID = sysGetEmployeeID( 0 ) if ( $employeeID != 0 ) { $employeeName = sysGetPlayerName( $employeeID ) osdaddat( TEXT, 100, 100, 400, 0, "", "Employee : $employeeName" ) } else { osdaddat( TEXT, 100, 100, 400, 0, "", "There is no-one currently employed at this building" ) } osdactivate() }
sysGetBuildingName
Format | sysGetBuildingName( [BuildingID] ) |
---|---|
Description | Returns the building name for a particular ID |
Parameters | Building ID number |
Returns | The building name |
Example:
Event( "UseItem", "Map" ) { $nearestTownID = sysGetNearestTown( $gPlayerWorldX, $gPlayerWorldY ) $nearestTownName = sysGetBuildingName( $nearestTownID ) *msg %PLAYER% The nearest town is $nearestTownName }
sysGetMaxJobs
TBD
sysBuildingActivateStockroom
sysBuildingActivateBuyItem
sysBuildingActivateSetPrices
sysBuildingActivateSellItem
sysBuildingActivateEmployeeList
scripting/reference/system_functions/buildinginformationfunctions.1580304417.txt.gz · Last modified: 2020/01/29 07:26 by mit