VoidExpanse/scope-game: Difference between revisions

From AtomicTorchWiki
No edit summary
Line 274: Line 274:
void |
void |
array: strings of types |
array: strings of types |
<pre style="margin:0px;">var res = station.GetItemTypes();</pre> |
<pre style="margin:0px;">var res = game.GetItemTypes();</pre> |
'''not implemented'''
'''not implemented'''
}}
{{Scripting_api|GetProjectileFromSystemByID|
* int: system_id
* int: projectile_id |
object:
* string: id
* double: coord_x
* double: coord_y
* int: caster_id |
<pre style="margin:0px;">var proj = game.GetProjectileFromSystemByID(15,2524);</pre> |
Returns basic information about specified projectile. ID in returned object is full projectile ID, which is
xml_weapon_id + "_" + number_of_projectile_in_weapon.
}}
{{Scripting_api|ProjectileFromSystemDestroy|
* int: system_id
* int: projectile_id |
void|
<pre style="margin:0px;">game.ProjectileFromSystemDestroy(15,2524);</pre> |
Destroys specified projectile.
}}
{{Scripting_api|ProjectileFromSystemSetSpeed|
* int: system_id
* int: projectile_id
* double: speed_x
* double: speed_y|
void|
<pre style="margin:0px;">game.ProjectileFromSystemSetSpeed(15,2524, 0, 0); //stop projectile</pre> |
Sets projectile linear speed. Useful for manipulating projectile speed, doesn't affect it's direction.
}}
}}

Revision as of 10:28, 13 March 2014


Scope game

Used for various in-game functions.

Visibility: Global.

List of functions

ApplyForceToObject
Arguments Returns Example
  • int: object_id
  • double: force_x
  • double: force_y

void

game.ApplyForceToObject(153, 10, 0); // add x-axis force
Description

Applies force to physics object. Will work on any interactive object.


ApplyTorqueToObject
Arguments Returns Example
  • int: object_id
  • double: torque

void

game.ApplyTorqueToObject(153, 10); // add torque
Description

Applies torque to physics object. Will work on any interactive object.


DamageProjectile
Arguments Returns Example
  • int: system_id
  • int: projectile_id
  • double: damage

void

game.DamageProjectile(1, 12, 10);
Description

Damages projectile. Projectile, that took enough damage, will explode.


TryToRemoveContentFromAsteroid
Arguments Returns Example
  • int: asteroid_id
  • string: name
  • int: amount

int: amount of content extracted from asteroid

game.TryToRemoveContentFromAsteroid(12, "ResourceOre", 10);
Description

Tries to remove specified resource from asteroid's contents. Returns extracted amount.


GetItemEffects
Arguments Returns Example
  • string: xml_item_id

array of objects:

  • double: effect_base
  • double: effect_cap
  • double: effect_per_level
  • double: effect_type
var effects = game.GetItemEffects("SomeItem");
Description

Returns an array of all effects of specified item.


GetItemPrice
Arguments Returns Example
  • string: xml_item_id

int: item_price

var price = game.GetItemPrice("SomeItem");
Description


GetItemSID
Arguments Returns Example
  • int: unique_item_id

string: xml_item_id

var xml_item_id = game.GetItemSID(12352);
Description

Returns xml_id of item by it's instance ID.


GetProjectileDescriptionByXmlID
Arguments Returns Example
  • string: projectile_xml_id

object:

  • double: damage
  • string: damage_type
var xml_item_id = game.GetProjectileDescriptionByXmlID("wpn_0");
Description

Gets projectile description. Projectile xml ID is constructed by the following rule: wpn_id + "_" + projectile_order (starting with 0).


GetSecondsMultiplier
Arguments Returns Example

void

void

var multiplier = game.GetSecondsMultiplier();
Description

Returns time passed since last frame. Useful when calculating time-depended stuff, like health-regeneration or damage.


GetGameObjectTags
Arguments Returns Example
  • int: object_id

void

var tags = game.GetGameObjectTags(131);
Description

Gets game object tags. Any physical object, such as asteroid, space object, ship or else, has it's own tags. This function can retrieve it. Alias of game.GetTags.


GetTags
Arguments Returns Example
  • int: object_id

void

var tags = game.GetTags(131);
Description

Gets game object tags. Any physical object, such as asteroid, space object, ship or else, has it's own tags. This function can retrieve it. The same as game.GetGameObjectTags.


GetShipOwner
Arguments Returns Example
  • int: ship_id

string: owner_name

var name = game.GetShipOwner(123142);
Description

Returns name of ship's owner. If ship is npc-controller, that would be npc name, else - player's name.


GetAsteroidMiningListByID
Arguments Returns Example
  • int: asteroid_id

array of objects:

  • string: xml_id
  • int: quantity
  • int: extraction
var list = game.GetAsteroidMiningListByID(1252);
Description

Returns actual ateroid mining list.


GetAsteroidDescriptionByID
Arguments Returns Example
  • int: asteroid_id

object:

  • int: type
  • int: difficulty
var desc = game.GetAsteroidDescriptionByID(1252);
Description

Returns asteroid description.


GetSkillEffects
Arguments Returns Example
  • string: skill_xml_id

array of objects:

  • int: cost
  • int: page
  • string: title
var effects = game.GetSkillEffects("SomeSkill");
Description

Returns array of specified skills' effects.


IsResource
Arguments Returns Example
  • string: item_xml_id

bool: is specified item resource

var is_res = game.IsResource("SomeItemOrResource");
Description


IsHull
Arguments Returns Example
  • string: item_xml_id

bool: is specified item is hull

var is_hull = game.IsHull("SomeItemOrResource");
Description


IsDevice
Arguments Returns Example
  • string: item_xml_id

bool: is specified item is device

var is_dev = game.IsDevice("SomeItemOrResource");
Description


IsWeapon
Arguments Returns Example
  • string: item_xml_id

bool: is specified item is weapon

var is_wpn = game.IsWeapon("SomeItemOrResource");
Description


IsShipPlayerControlled
Arguments Returns Example
  • int: ship_id

bool: is ship controlled by player

var is_player = game.IsShipPlayerControlled(123252);
Description


GetSystemJumpgates
Arguments Returns Example
  • int: system_id

array: IDs of system jumpgates

var jumpgates = game.GetSystemJumpgates(1);
Description

Returns all jumpgates of specified system.


GetSystemBases
Arguments Returns Example
  • int: system_id

array: IDs of system bases

var bases = game.GetSystemBases(1);
Description

Returns all bases of specified system.


GetSystemShips
Arguments Returns Example
  • int: system_id

array: IDs of system ships

var ships = game.GetSystemShips(1);
Description

Returns all ships of specified system.


GetSystemShipsOfClass
Arguments Returns Example
  • int: system_id
  • string: tags_class

array: IDs of system ships

var miner_ships = game.GetSystemShipsOfClass(1, "miner");
Description

Returns all ships of specified system, which tag "class" is equal to specified value.


GetSystemPlayersShips
Arguments Returns Example
  • int: system_id

array: IDs of system players' ships

var ships = game.GetSystemPlayersShips(1);
Description

Returns all player-controlled ships of specified system.


GetObjectCoordinates
Arguments Returns Example
  • int: system_id
  • int: object_id

vector2: coordinates

var coords = game.GetObjectCoordinates(1, 25442);
Description

Returns coordinates of specified object.


DeleteGameObject
Arguments Returns Example
  • int: object_id

void

game.DeleteGameObject(25442);
Description

Deletes game object from game world.


GetBaseEntryPointsByID
Arguments Returns Example
  • int: base_id

array of vector2

var points = game.GetBaseEntryPointsByID(353);
Description

Returns bases' actual entry points coordinates.


SetSecondsBetweenStarSystemUpdates
Arguments Returns Example
  • int: system_id
  • int: seconds

void

game.SetSecondsBetweenStarSystemUpdates(1, 60);
Description

Sets interval between event "OnStarSystemUpdate" for this system calls.


SendNotification
Arguments Returns Example
  • string: player_name
  • string: title
  • string: message

void

game.SendNotification("dlirry", "Server notification", "You are great player!");
Description

Sends notification to connected player.


GetAllItems
Arguments Returns Example

void

array: xml-ids (strings) of all items

var res = game.GetAllItems();
Description

Gets all items.


GetItems
Arguments Returns Example
  • int: level
  • string[]: item_types

array: xml-ids (strings) of items

var res = game.GetItems(15, ["Hull", "Consumable"]);
Description

Gets all items of specified type.


GetItemTypes
Arguments Returns Example

void

array: strings of types

var res = game.GetItemTypes();
Description

not implemented


GetProjectileFromSystemByID
Arguments Returns Example
  • int: system_id
  • int: projectile_id

object:

  • string: id
  • double: coord_x
  • double: coord_y
  • int: caster_id
var proj = game.GetProjectileFromSystemByID(15,2524);
Description

Returns basic information about specified projectile. ID in returned object is full projectile ID, which is xml_weapon_id + "_" + number_of_projectile_in_weapon.


ProjectileFromSystemDestroy
Arguments Returns Example
  • int: system_id
  • int: projectile_id

void

game.ProjectileFromSystemDestroy(15,2524);
Description

Destroys specified projectile.


ProjectileFromSystemSetSpeed
Arguments Returns Example
  • int: system_id
  • int: projectile_id
  • double: speed_x
  • double: speed_y

void

game.ProjectileFromSystemSetSpeed(15,2524, 0, 0); //stop projectile
Description

Sets projectile linear speed. Useful for manipulating projectile speed, doesn't affect it's direction.