VoidExpanse/scope-game: Difference between revisions

From AtomicTorchWiki
(Created page with "<noinclude> Category:VoidExpanse/api_scopes </noinclude> = Scope game = Used for various in-game functions. '''Visibility:''' Global. == List of functions == {{Scripti...")
 
 
(4 intermediate revisions by the same user not shown)
Line 59: Line 59:
}}
}}


{{Scripting_api|GetStationDockedNpcs|
* int: station_id|
array of int|
<pre style="margin:0px;">var npcs = game.GetStationDockedNpcs(25353);</pre> |
Returns an array of IDs of all ships, that are docked to a station.
}}


{{Scripting_api|GetItemPrice|
{{Scripting_api|GetItemPrice|
Line 253: Line 259:
<pre style="margin:0px;">game.SendNotification("dlirry", "Server notification", "You are great player!");</pre> |
<pre style="margin:0px;">game.SendNotification("dlirry", "Server notification", "You are great player!");</pre> |
Sends notification to connected player.
Sends notification to connected player.
}}
{{Scripting_api|GetAllItems|
void |
array: xml-ids (strings) of all items |
<pre style="margin:0px;">var res = game.GetAllItems();</pre> |
Gets all items.
}}
{{Scripting_api|GetItems|
* int: level
* string[]: item_types |
array: xml-ids (strings) of items |
<pre style="margin:0px;">var res = game.GetItems(15, ["Hull", "Consumable"]);</pre> |
Gets all items of specified type.
}}
{{Scripting_api|GetItemTypes|
void |
array: strings of types |
<pre style="margin:0px;">var res = game.GetItemTypes();</pre> |
'''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.
}}
{{Scripting_api|PlaySound|
* string: player_name
* string: sound |
void|
<pre style="margin:0px;">game.PlaySound("Neolog", "special/blast_sound.ogg");</pre> |
Plays a special sound on a client's side for specified player.
}}
{{Scripting_api|ShipPlaySound|
* int: ship_id
* string: sound_id
* string: sound_path
* double: delay
* bool: isLooping|
void|
<pre style="margin:0px;">game.ShipPlaySound(123, "grappler_1", "special/grappler_process.ogg", 0.1, true);</pre> |
Emits specified sound from specified ship. If isLooping is on, then sound must be stopped with game.ShipStopSound command. Sound_id argument must be unique inside ship's sounds and used for stopping looping sounds.
}}
{{Scripting_api|ShipStopSound|
* int: ship_id
* string: sound_id|
void|
<pre style="margin:0px;">game.ShipStopSound(123, "grappler_1");</pre> |
Stops the looping sound, that was started with game.ShipPlaySound command.
}}
}}

Latest revision as of 03:51, 5 July 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.


GetStationDockedNpcs
Arguments Returns Example
  • int: station_id

array of int

var npcs = game.GetStationDockedNpcs(25353);
Description

Returns an array of IDs of all ships, that are docked to a station.


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.


PlaySound
Arguments Returns Example
  • string: player_name
  • string: sound

void

game.PlaySound("Neolog", "special/blast_sound.ogg");
Description

Plays a special sound on a client's side for specified player.


ShipPlaySound
Arguments Returns Example
  • int: ship_id
  • string: sound_id
  • string: sound_path
  • double: delay
  • bool: isLooping

void

game.ShipPlaySound(123, "grappler_1", "special/grappler_process.ogg", 0.1, true);
Description

Emits specified sound from specified ship. If isLooping is on, then sound must be stopped with game.ShipStopSound command. Sound_id argument must be unique inside ship's sounds and used for stopping looping sounds.


ShipStopSound
Arguments Returns Example
  • int: ship_id
  • string: sound_id

void

game.ShipStopSound(123, "grappler_1");
Description

Stops the looping sound, that was started with game.ShipPlaySound command.