VoidExpanse/scope-station: Difference between revisions

From AtomicTorchWiki
(Created page with "<noinclude> Category:VoidExpanse/api_scopes </noinclude> = Scope station = Useful during store generation process. '''Visibility:''' Global. == List of functions == {{...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 33: Line 33:




{{Scripting_api|GetAllItems|
{{Scripting_api|GenerateStockDistribution|
void |
* int: base_id|
array: xml-ids (strings) of all items |
object:
<pre style="margin:0px;">var res = station.GetAllItems();</pre> |
type: quantity|
Gets all items.
<pre style="margin:0px;">station.GenerateStockDistribution(12);</pre> |
Generates stock distribution (type_of_good => quantity) based on xml data of station.
}}
}}


{{Scripting_api|GetAllItemsFitsToStationLevel|
* int: station_id |
array: xml-ids (strings) of items |
<pre style="margin:0px;">var res = station.GetAllItemsFitsToStationLevel(132);</pre> |
Gets all items, which shops_level parameter is equal or below specified station's level (actually, station has no level, so system's tech level, in which station is situated, will be taken).
}}


{{Scripting_api|GetAllItemsOfItemType|
{{Scripting_api|GetCivilianItems|
* string: item_type |
void|
array: xml-ids (strings) of items |
arrqy of string IDs|
<pre style="margin:0px;">var res = station.GetAllItemsOfItemType("Hulls");</pre> |
<pre style="margin:0px;">station.GetCivilianItems();</pre> |
Gets all items of specified type. Types are: "Devices", "Hulls", "Resources", "Weapons". All types can be gained with station.GetItemTypes.
Returns IDs of items with xml flag "civilian".
}}
}}


{{Scripting_api|GetItemTypes|
{{Scripting_api|GetRandomTradeRoute|
void |
* int: ship
array: strings of types |
* int: radus|
<pre style="margin:0px;">var res = station.GetItemTypes();</pre> |
object:
Return all items types. Useful with function station.GetAllItemsOfItemType.
* int: station_sell_id
* int: station_buy_id
* int: system_sell_id
* int: system__buy_id
* string: station_sell
* string: station_buy
* string: system_sell
* string: system_buy
* string: good
* int: jumps (length of route)
* double: time_left|
<pre style="margin:0px;">var route = station.GetRandomTradeRoute(1324, 4);</pre> |
Returns a trade route for ship withing systems of specified range.
}}
}}

Latest revision as of 03:57, 5 July 2014


Scope station

Useful during store generation process.

Visibility: Global.

List of functions

AddItem
Arguments Returns Example
  • int: base_id
  • string: item_type
  • (optional) int: quantity

void

station.AddItem(12, "SomeItemToSell", 10);
Description

Adds item to station's store.


GetBaseByID
Arguments Returns Example
  • int: base_id

object:

  • string: faction
  • int: tech_level
  • string: name
  • double: coord_x
  • double: coord_y
station.GetBaseByID(131);
Description

Returns info about base.


GenerateStockDistribution
Arguments Returns Example
  • int: base_id

object: type: quantity

station.GenerateStockDistribution(12);
Description
{{{5}}}


GetCivilianItems
Arguments Returns Example

void

arrqy of string IDs

station.GetCivilianItems();
Description

Returns IDs of items with xml flag "civilian".


GetRandomTradeRoute
Arguments Returns Example
  • int: ship
  • int: radus

object:

  • int: station_sell_id
  • int: station_buy_id
  • int: system_sell_id
  • int: system__buy_id
  • string: station_sell
  • string: station_buy
  • string: system_sell
  • string: system_buy
  • string: good
  • int: jumps (length of route)
  • double: time_left
var route = station.GetRandomTradeRoute(1324, 4);
Description

Returns a trade route for ship withing systems of specified range.