API:CMyShip

From STNE Wiki

Jump to: navigation, search
Scripting Portal | Contents | API Reference | Index

CMyShip is the most important Class in the Scriptengine. CMyShip inherits all Methods and propertys of CShip.

For comprehension a short Example with one of your Ship with NCC-Id 123456

Var Ship As New CMyShip(123456);

Now is in the Variable Ship an instance of the object CMyShip.

A view in the Objectexplorer (http://game.stne.net/ObjectExplorer.aspx?p=CMyShip) shows, what you can do with it:

WriteLine(Ship.Name & " has got currently " & Ship.Energy & " Energy");

In Addition there are Actions possible by help from the object CBaseShipManager. For further informations look in the documentation from this object.

Example:

Ship.Action.ActivateSRS(True);


The most important properties and methos are:

  • Action CBaseShipManager
  • Energy ---> returns a Number
  • Docked ---> returns true or false
  • FlightRange ---> gives you the amount of flied fields in this tick
  • Name
  • StockRoom --> Give you an instance from the class SStockRoom, which it you can see the amount of goods in the stockroom
  • SRS ---> Give you an instance from the class CShipList with all ships in the SRS
  • WarpCore --> Amount of the WarpCore


With this properties its for example possible to perform a script to refill the warpcore:


 Var Ship As CMyShip(12345);
 If (Ship.WarpCore < 100) {
   If (Ship.Docked = False) { 
     Ship.Action.DockTo(54321);
   }
   Ship.Action.TransferFromShip(54321, 10, EBeamResource.Deuterium);
   Ship.Action.TransferFromShip(54321, 10, EBeamResource.Antimatter);
   Ship.Action.TransferFromShip(54321, 5, EBeamResource.Dilicium);
   Ship.Action.RefilWarpCore(10);
 }
 WriteLine("Now are " & Ship.WarpCore & " units in your warpcore");


Please note: You can only create instances from CMyShip with your own ships. Other ships can you only handle with CShip - but you cant create it via NCC-Id. You can only work with CMyShip, when a function return it, i.e the SRS-list of Ship.SRS (it returns a list with instances of CShip

Personal tools