Difference between revisions of "Cabal Common Library Doc SpecialMarkets"
m (added note about changes) |
Cholmondely (talk | contribs) (→Overview: Added cim's summary) |
||
Line 6: | Line 6: | ||
A calculator (OpenOffice format) for OXP developers is available: [http://www.box.com/s/68r3dqmv9sn605gy3up8 CCL_SpecialMarkets_Calc.zip] (21.3 KB). | A calculator (OpenOffice format) for OXP developers is available: [http://www.box.com/s/68r3dqmv9sn605gy3up8 CCL_SpecialMarkets_Calc.zip] (21.3 KB). | ||
+ | |||
+ | CCL_SM cargo only takes up hold space as either "entire hold useSpecialCargo" or as an awardContract cargo delivery contract for one of the standard 17. If it's neither "block" nor "contract" it takes up no space. | ||
== Functions == | == Functions == |
Revision as of 13:43, 11 September 2023
Overview
This is the main class for the special markets with its members and part of the Cabal_Common_Library.
The script gives another option for trading in special goods and calculates prices and availabilities for inserted items.
A calculator (OpenOffice format) for OXP developers is available: CCL_SpecialMarkets_Calc.zip (21.3 KB).
CCL_SM cargo only takes up hold space as either "entire hold useSpecialCargo" or as an awardContract cargo delivery contract for one of the standard 17. If it's neither "block" nor "contract" it takes up no space.
Functions
registerLocation()
worldScripts.Cabal_Common_SpecialMarkets.registerLocation(obj); |
Scripts can specify systems where items can be bought or sold. Only one object with a few properties has to be passed.
Properties of obj:
- item
- String. Required. Unique Name. Max length 40 chars.
- galaxy
- Array. Required. Galaxy [0...7].
- buyID
- Array. Required. System.IDs [0...255].
- sellID
- Array. Required. System.IDs. If sold (and no contract) callback [0...255].
- stationID
- Array. Required. Specified stations for buy and sell, e.g. [["main"],["MyStation"]].
- cb
- String. Required. worldScript name for callback.
- cbb
- String. Required. Function that handles the delivery if !contract.
- priceclass
- Number. Required. Base priceclass. The higher the lower the production. [5...100].
- refresh
- Number. Required. Units produced every day [0...1].
- desc
- String. Required. Description.
- block
- Boolean. Blocks cargohold on purchase. If true disables contract.
- contract
- String. If !block it turns it into a cargo contract to a random system in sellID.
- offset
- Number. Sell multiplier for calculated price [1.3...5]. Default 1.3.
- avail
- Number. Starting availability [0...25]. Higher values will lower the prices. Default 0.
- times
- Number. Start time [clock.days-1000...clock.days]. Default clock.days.
- decrease
- Number. Affects prices and produced units over time [0.01...0.5]. Default 0.1.
- legal
- Boolean. Legality of this item. Default true.
- model
- String. Role. Default "cargopod".
- oneShot
- Boolean. One shot deal. If true item will be removed after selling.
Returns:
- success
- Boolean. True on success.
removeTradeItem()
worldScripts.Cabal_Common_SpecialMarkets.removeTradeItem(item); |
Removes the specified item.
Parameters:
- item
- String. Item to be removed.
Returns:
- nothing.
checkPSHold()
worldScripts.Cabal_Common_SpecialMarkets.checkPSHold(item); |
Convenience check if player has a specific item in his hold.
Parameters:
- item
- String. Item to be checked.
Returns:
- n
- Number. Amount.