Scripting:Ore Collector Control

From STNE Wiki

(Difference between revisions)
Jump to: navigation, search
Jacksfh (Talk | contribs)
(Created page with "{{menu}} {{ScriptingMenu}} ==Deuterium Tanker Control== Upon entering the portal, all ore collectors in the sector (the sector that the ship is in on which the portal is set up)...")
Newer edit →

Revision as of 20:16, 23 May 2012

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 ore collectors in the sector (the sector that the ship is in on which the portal is set up) will use maximum energy to collect Iridium Ore. It will then report how much ore each ship collected.

If a tanker is docked, it will first undock and dock again after collecting iridium.

The portal will only do anything if the owner of the ship is the person using the portal.

Script created by Glest Durnham (6609)

Script Code

 #UseInterface Web, ShipPortal;

Var scriptName As String = "GC_Miner_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 an ore collector.
      If (curShip.TypName = "Antares" OR curShip.TypName = "Andorra" OR curShip.TypName = "Antares prototype"
OR curShip.TypName = "Capo" OR curShip.TypName = "Gathering Station" OR curShip.TypeName = "Atria"") { // Save initial information curMyShip = New CMyShip(curShip.ShipID); dockedTo = - 1; oldQuantity = curMyShip.Lager.Menge(EWarenTyp.Erz); // Save docking information and undock If (curMyShip.Angedockt) { dockedTo = curMyShip.AngedocktAnID; curMyShip.Aktion.Abdocken(); } // Perform the action curMyShip.Aktion.ErzSammeln(1000); // Calculate the result Var collected As Integer = curMyShip.Lager.Menge(EWarenTyp.Erz) - oldQuantity; // Re-dock If (dockedTo > - 1) { curMyShip.Aktion.AndockenAn(dockedTo); } // Output result Response.Add(curMyShip.Name & " (NCC " & curMyShip.ShipID & ") collected " & collected & " Iridium ore."); Response.Add(New CHtmlBreak()); } } } }

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


Personal tools