Scripting:Tanker Control

From STNE Wiki

(Difference between revisions)
Jump to: navigation, search
(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 ...")
 
(4 intermediate revisions not shown)
Line 1: Line 1:
 +
{{menu}}
 +
{{ScriptingMenu}}
==Deuterium Tanker Control==
==Deuterium Tanker Control==
Line 7: Line 9:
The portal will only do anything if the owner of the ship is the person using the portal.
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 originally created by Glest Durnham (6609), edited by Jacus (60589) to include extra ships e.g. Gathering Station
==Script Code==
==Script Code==
Line 29: Line 31:
     {
     {
       // Make sure it's a deuterium tanker.
       // 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" <br> OR curShip.TypeName = "Constitution" OR curShip.TypeName = "Atria" OR curShip.TypeName = "DY-500")
+
       If (curShip.TypeName = "Indus" OR curShip.TypeName = "Kale" OR curShip.TypeName = "Indus prototype" OR curShip.TypeName = "Rigel" OR curShip.TypeName = "Gathering Station" <br> OR curShip.TypeName = "Atria" OR curShip.TypeName = "DY-500")
       {
       {
         // Save initial information
         // Save initial information
Line 63: Line 65:
   }
   }
  }
  }
 +
{{Note|Feature pack is required to be able to use this script.}}
 +
[[Category:Scripting]]

Latest revision as of 12:23, 22 April 2014

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