API:CMyShip

From STNE Wiki

(Difference between revisions)
Jump to: navigation, search
Phips (Talk | contribs)
(Created page with "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 NC...")
Newer edit →

Revision as of 21:28, 19 August 2010

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 " & Schiff.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:

Schiff.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 " & Schiff.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