Class ExampleScript1

java.lang.Object
  extended by com.swath.UserDefinedScript
      extended by ExampleScript1

public class ExampleScript1
extends UserDefinedScript

This is my first SWATH script. It moves your ship to a sector and lands on a planet there.

Since:
SWATH 1.3

Constructor Summary
ExampleScript1()
           
 
Method Summary
 void endScript(boolean finished)
          Called by the framework when the script is finished.
static void exec(int sector, Planet planet)
          Moves your ship to a sector and lands on a planet there.
 java.lang.String getDescription()
          Called by the framework to get the description of the script.
 java.lang.String getName()
          Called by the framework to get the name of the script.
 boolean initScript()
          Called by the framework to initialise the script.
 boolean runScript()
          Called by the framework to run the script.
 
Methods inherited from class com.swath.UserDefinedScript
atPrompt, execInstance, getClassName, getParams, getResource, initInstance, postEvent, printTrace, printTrace, registerParam, showUserParamWindow, showUserParamWindow, sleep
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleScript1

public ExampleScript1()
Method Detail

getName

public java.lang.String getName()
Description copied from class: UserDefinedScript
Called by the framework to get the name of the script.
You should override this method.

Overrides:
getName in class UserDefinedScript
Returns:
The script name.

getDescription

public java.lang.String getDescription()
Description copied from class: UserDefinedScript
Called by the framework to get the description of the script.
You should override this method to provide a script description.

The script description can be an URL to a HTML page or file. It can also be normal HTML text or plain text.

By default, a file named ScriptClass.html or ScriptClass.txt is used if found.

Examples:

Overrides:
getDescription in class UserDefinedScript
Returns:
The script description.

initScript

public boolean initScript()
                   throws java.lang.Exception
Description copied from class: UserDefinedScript
Called by the framework to initialise the script.
You should override this method to make your own initialisation.

Overrides:
initScript in class UserDefinedScript
Returns:
true if the initialisation was successful, otherwise false.
Throws:
java.lang.Exception
See Also:
UserDefinedScript.atPrompt(int), UserDefinedScript.showUserParamWindow(Panel,int,int), UserDefinedScript.showUserParamWindow(JPanel,int,int)

runScript

public boolean runScript()
                  throws java.lang.Exception
Description copied from class: UserDefinedScript
Called by the framework to run the script.
You should override this method to define the script body.

Overrides:
runScript in class UserDefinedScript
Returns:
true if the script finished correctly, otherwise false.
Throws:
java.lang.Exception

endScript

public void endScript(boolean finished)
               throws java.lang.Exception
Description copied from class: UserDefinedScript
Called by the framework when the script is finished.
You can override this method to clean up after the script if needed.

Overrides:
endScript in class UserDefinedScript
Parameters:
finished - true if the script finished correctly or false if the script was interrupted in some way.
Throws:
java.lang.Exception

exec

public static void exec(int sector,
                        Planet planet)
                 throws java.lang.Exception
Moves your ship to a sector and lands on a planet there.

Parameters:
sector - The sector to move to.
planet - The planet to land on.
Throws:
java.lang.Exception