Scripting:Tanker Control
From STNE Wiki
(Difference between revisions)
Jacksfh (Talk | contribs)
(Created page with "==Deuterium Tanker Control== Upon entering the portal, all deuterium tankers in the sector (the sector that the ship is in on wich the portal is set up) will use maximum energy ...")
Newer edit →
(Created page with "==Deuterium Tanker Control== Upon entering the portal, all deuterium tankers in the sector (the sector that the ship is in on wich the portal is set up) will use maximum energy ...")
Newer edit →
Revision as of 15:06, 1 January 2012
Deuterium Tanker Control
Upon entering the portal, all deuterium tankers in the sector (the sector that the ship is in on wich the portal is set up) will use maximum energy to collect deuterium. It will then report how much deuterium each tanker collected.
If a tanker is docked, it will first undock and dock again after collecting deuterium.
The portal will only do anything if the owner of the ship is the person using the portal.
Script originally created by Glest Durnham (6609), edited by Jacksfh (60589) to include extra ships e.g. Gathering Station
Script Code
#UseInterface Web, ShipPortal; Var scriptName As String = "Tanker Control"; If(GuestUser.UserID = MyShip.UserID) { Var curShip As CShip; Var curMyShip As CMyShip; Var dockedTo As Integer = - 1; Var oldQuantity As Integer = 0; // Loop all ships in the sector For (Each curShip In MyShip.SRS) { // Make sure we own it If (curShip.UserID = MyShip.UserID) { // Make sure it's a deuterium tanker. If (curShip.TypeName = "Indus" OR curShip.TypeName = "Kale" OR curShip.TypeName = "Indus prototype" OR curShip.TypeName = "Rigel" OR curShip.TypeName = "Gathering Station"
OR curShip.TypeName = "Constitution" OR curShip.TypeName = "Atria" OR curShip.TypeName = "DY-500") { // Save initial information curMyShip = New CMyShip(curShip.ShipID); dockedTo = - 1; oldQuantity = curMyShip.StockRoom.Amount(EGoodsType.Deuterium); // Save docking information and undock If (curMyShip.Docked) { dockedTo = curMyShip.DockedToShipID; curMyShip.Action.Undock(); } // Perform the action curMyShip.Action.CollectDeuterium(2000); // Calculate the result Var collected As Integer = curMyShip.StockRoom.Amount(EGoodsType.Deuterium) - oldQuantity; // Re-dock If (dockedTo > - 1) { curMyShip.Action.DockTo(dockedTo); } // Output result Response.Add(curMyShip.Name & " (NCC " & curMyShip.ShipID & ") collected " & collected & " Deuterium."); Response.Add(New CHtmlBreak()); } } } }