Scripting:Tanker Control

From STNE Wiki

Revision as of 12:23, 22 April 2014 by Jacksfh (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

STNE is a Strategy and Role Play Game. You can play here.

Contents | STNE | Colonies | Buildings | Goods | Items | NPC | Ships | Stellar Cartography | Research | Trade | Combat | Settler | Alliances | Index


Main | Syntax | Operators | Interfaces | FAQ | Contents | API Reference | Index

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 Jacus (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 = "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()); } } } }

Note: Feature pack is required to be able to use this script.


Personal tools