Using Script Arguments

 

At the top of the script editor window, you will find a section for arguments, this is just below the script details like version.

Arguments

You can add as many arguments as you like, each time you add one it will be listed in this section. Going to "<New Argument>" will allow you to add a new one to the list.

Arguments are used to send data into the script. When calling it from another script you can send in varibles to be used in the calling scripts.

If its used for a command script, then when using the command, the user will be asked to select each argument. This is also the same when you manually run the script.

 

Arguments are 3 values, and you enter them one after the other, the first is the varible name

Name

The next is the argument type, when manually running or using via a command this will determine the type of menu selection to display. IE, setting to var/Sector will cause it to bring up the sector map to ask for a sector.

Var/Ship

The final is the string to display, this is displayed in the menu when selecting the object, or the name for the argument when using the "call script" command.

String

Once you have entered all the values, it will be added to the argument list.

Argument

You can edit it by selecting the argument again and going through the process, or you can delete it by pressing the "Delete" key. To add another argument move to the "<New Argument>" again.

 

When running the script, you will be asked about each argument you have. The first is the object you want to run it on, for this example just choose null. Next it will display all the arguments available.

Run

Then it will display each argument in turn asking for your input. The type of input depends on the argument type you have set.

Select Ship

You can either set null, or the argument type, in this chase its select Ship. When selecting, you will then have to select a ship. For this argument, you must first select the sector then select a ship in that sector.

Sector

Select Ship

As stated, the selection depends on the type you've selected, ie if the type is Var/Ware, then you will have a list of avaialble wares to select from.

Once selected all the argument the script will be run like normal.

If its run as a ship command, it skips the display of the arguments available, as well as the null and argument type select menu. So for this example, it will start by displaying the sector map to choose a ship.

 

Call Script Command

The call script command is used to call a script to use in another one. Each of the arguments will be displayed in the command for you to set each varible/type to use.

Call Script

As you can see, theres you one argument with the string you entered, "Select Ship". Selecting this will bring up the same menu as if you run the script manually. You can also use a varible instead. However, you cant use this to bring up the menu when the script is run, the only way to get input from the play is by using it as arguments.

Varible Call Script

Which ever ship object is in the $ship varible will be sent to the calling script.

 


<< Prev (Conditional Statements)        Next (Create Wares) >>