API:CMyShip
From STNE Wiki
(One intermediate revision not shown) | |||
Line 10: | Line 10: | ||
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: | ||
- | {{Code|WriteLine(Ship.Name & " has got currently " & | + | {{Code|WriteLine(Ship.Name & " has got currently " & Ship.Energy & " Energy");}} |
In Addition there are Actions possible by help from the object [[API:CBaseShipManager|CBaseShipManager]]. | In Addition there are Actions possible by help from the object [[API:CBaseShipManager|CBaseShipManager]]. | ||
Line 45: | Line 45: | ||
Ship.Action.RefilWarpCore(10); | Ship.Action.RefilWarpCore(10); | ||
} | } | ||
- | WriteLine("Now are " & | + | WriteLine("Now are " & Ship.WarpCore & " units in your warpcore"); |
Line 51: | Line 51: | ||
''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. | ''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'' | ||
+ | |||
+ | [[Category:API]] |
Latest revision as of 18:57, 2 May 2020
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