API:CMyShip

From STNE Wiki

(Difference between revisions)
Jump to: navigation, search
(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...")
Line 1: Line 1:
-
CMyShip is the most important Class in the Scriptengine. CMyShip inherits all Methods and propertys of [[CShip]].
+
[[API:CMyShip|CMyShip]] is the most important Class in the Scriptengine. [[API:CMyShip|CMyShip]] inherits all Methods and propertys of [[API:CShip|CShip]].
For comprehension a short Example with one of your Ship with NCC-Id 123456
For comprehension a short Example with one of your Ship with NCC-Id 123456
Line 5: Line 5:
{{Code|Var Ship As New CMyShip(123456);}}
{{Code|Var Ship As New CMyShip(123456);}}
-
Now is in the Variable Ship an instance of the object CMyShip.
+
Now is in the Variable Ship an instance of the object [[API:CMyShip|CMyShip]].
A view in the Objectexplorer (http://game.stne.net/ObjectExplorer.aspx?p=CMyShip) shows, what you can do with it:
A view in the Objectexplorer (http://game.stne.net/ObjectExplorer.aspx?p=CMyShip) shows, what you can do with it:
Line 11: Line 11:
{{Code|WriteLine(Ship.Name & " has got currently " & Schiff.Energy & " Energy");}}
{{Code|WriteLine(Ship.Name & " has got currently " & Schiff.Energy & " Energy");}}
-
In Addition there are Actions possible by help from the object [[CBaseShipManager]].
+
In Addition there are Actions possible by help from the object [[API:CBaseShipManager|CBaseShipManager]].
For further informations look in the documentation from this object.
For further informations look in the documentation from this object.
Line 21: Line 21:
The most important properties and methos are:
The most important properties and methos are:
-
*Action [[CBaseShipManager]]
+
*Action [[API:CBaseShipManager|CBaseShipManager]]
*Energy ---> returns a Number
*Energy ---> returns a Number
*Docked ---> returns true or false
*Docked ---> returns true or false
*FlightRange ---> gives you the amount of flied fields in this tick
*FlightRange ---> gives you the amount of flied fields in this tick
*Name  
*Name  
-
*StockRoom --> Give you an instance from the class [[SStockRoom]], which it you can see the amount of goods in the stockroom
+
*StockRoom --> Give you an instance from the class [[API:SStockRoom|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
+
*SRS ---> Give you an instance from the class [[API:CShipList|CShipList]] with all ships in the SRS
*WarpCore --> Amount of the WarpCore
*WarpCore --> Amount of the WarpCore
Line 48: Line 48:
-
''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.
+
''Please note: You can only create instances from [[API:CMyShip|CMyShip]] with your own ships. Other ships can you only handle with [[API:CShip|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''
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''

Revision as of 21:48, 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