Scripting:Interfaces
From STNE Wiki
(→ColoniePortal) |
|||
(5 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Scripting]] | ||
+ | {{ScriptingMenu}} | ||
+ | |||
Interfaces extend the possibilities of scripts by registering pre-defined variables. | Interfaces extend the possibilities of scripts by registering pre-defined variables. | ||
- | For example, the | + | For example, the {{code|Web}} interface provides two variables representing the HTTP request and response. |
Using this interface, scripts can generate HTML output and get some information about the HTTP request. | Using this interface, scripts can generate HTML output and get some information about the HTTP request. | ||
You can use an interface in a script by going to the settings tab in the script editor and ticking the interfaces you want to use. | You can use an interface in a script by going to the settings tab in the script editor and ticking the interfaces you want to use. | ||
You can also do it manually by adding this code at the top of the script: | You can also do it manually by adding this code at the top of the script: | ||
- | + | #UseInterface Web, ShipPortal // a comma separated list of interfaces | |
== Web == | == Web == | ||
- | The | + | The {{code|Web}} interface provides a script with the ability to generate HTML output and to read some information about the HTTP request. |
=== Registered variables === | === Registered variables === | ||
- | ; Response As CWebResponse | + | ; {{code|Response As CWebResponse}} |
: This represents the root element for your script's HTML response. By adding elements to Response, the script can generate HTML output. | : This represents the root element for your script's HTML response. By adding elements to Response, the script can generate HTML output. | ||
- | ; Request As CWebRequest | + | ; {{code|Request As CWebRequest}} |
: This contains some data describing the HTTP request and some additional data added by STNE. Most notably, it contains the submitted form data. | : This contains some data describing the HTTP request and some additional data added by STNE. Most notably, it contains the submitted form data. | ||
== ShipPortal == | == ShipPortal == | ||
- | The | + | The {{code|ShipPortal}} interface enables a script to be used as a ship portal. |
Ship portals can be installed on a ship. | Ship portals can be installed on a ship. | ||
Anyone with a ship in the same sector can enter the ship's portal, and they will see the HTML output generated by the script. | Anyone with a ship in the same sector can enter the ship's portal, and they will see the HTML output generated by the script. | ||
Line 26: | Line 29: | ||
The interface provides a few variables exposing on which ship the portal is running, and the user and ship that entered the portal. | The interface provides a few variables exposing on which ship the portal is running, and the user and ship that entered the portal. | ||
- | It also seems to include everything the | + | It also seems to include everything the {{code|Web}} interface provides. |
- | However, it is recommended to also include the | + | However, it is recommended to also include the {{code|Web}} interface whenever you include this interface. |
=== Registered variables === | === Registered variables === | ||
- | ; MyShip As CMyShip | + | ; {{code|MyShip As CMyShip}} |
: This is the ship the portal is running on. | : This is the ship the portal is running on. | ||
- | ; GuestShip | + | ; {{code|GuestShip As CShip}} |
: This is the ship that the guest entered the portal from. | : This is the ship that the guest entered the portal from. | ||
- | ; GuestUser As CUser | + | ; {{code|GuestUser As CUser}} |
: The user who entered the portal. | : The user who entered the portal. | ||
- | + | == ColoniePortal == | |
- | == | + | The {{code|ColoniePortal}} interface enables a script to be used as a colony portal. |
- | The | + | Colony portals can be installed on a colony. |
- | Colony portals can be installed on a | + | |
Anyone with a ship in the same sector can enter the colony's portal, and they will see the HTML output generated by the script. | Anyone with a ship in the same sector can enter the colony's portal, and they will see the HTML output generated by the script. | ||
By adding forms to the output you can also have the guest enter data which will be available to the script when the form is submitted. | By adding forms to the output you can also have the guest enter data which will be available to the script when the form is submitted. | ||
- | See the | + | See the {{code|Web}} interface on details how to generate output. |
The interface provides a few variables exposing on which ship the portal is running, and the user and ship that entered the portal. | The interface provides a few variables exposing on which ship the portal is running, and the user and ship that entered the portal. | ||
- | It also seems to include everything the | + | It also seems to include everything the {{code|Web}} interface provides. |
- | However, it is recommended to also include the | + | However, it is recommended to also include the {{code|Web}} interface whenever you include this interface. |
=== Registered variables === | === Registered variables === | ||
- | ; MyColony As CMyColony | + | ; {{code|MyColony As CMyColony}} |
: This is the colony the portal is running on. | : This is the colony the portal is running on. | ||
- | ; GuestShip | + | ; {{code|GuestShip As CShip}} |
: This is the ship that the guest entered the portal from. | : This is the ship that the guest entered the portal from. | ||
- | ; GuestUser As CUser | + | ; {{code|GuestUser As CUser}} |
: The user who entered the portal. | : The user who entered the portal. |
Latest revision as of 10:34, 11 September 2010
Main | Syntax | Operators | Interfaces | FAQ | Contents | API Reference | Index |
---|
Interfaces extend the possibilities of scripts by registering pre-defined variables.
For example, the Web interface provides two variables representing the HTTP request and response.
Using this interface, scripts can generate HTML output and get some information about the HTTP request.
You can use an interface in a script by going to the settings tab in the script editor and ticking the interfaces you want to use. You can also do it manually by adding this code at the top of the script:
#UseInterface Web, ShipPortal // a comma separated list of interfaces
Contents |
Web
The Web interface provides a script with the ability to generate HTML output and to read some information about the HTTP request.
Registered variables
- Response As CWebResponse
- This represents the root element for your script's HTML response. By adding elements to Response, the script can generate HTML output.
- Request As CWebRequest
- This contains some data describing the HTTP request and some additional data added by STNE. Most notably, it contains the submitted form data.
ShipPortal
The ShipPortal interface enables a script to be used as a ship portal. Ship portals can be installed on a ship. Anyone with a ship in the same sector can enter the ship's portal, and they will see the HTML output generated by the script. By adding forms to the output you can also have the guest enter data which will be available to the script when the form is submitted. See the 'Web' interface on details how to generate output.
The interface provides a few variables exposing on which ship the portal is running, and the user and ship that entered the portal. It also seems to include everything the Web interface provides. However, it is recommended to also include the Web interface whenever you include this interface.
Registered variables
- MyShip As CMyShip
- This is the ship the portal is running on.
- GuestShip As CShip
- This is the ship that the guest entered the portal from.
- GuestUser As CUser
- The user who entered the portal.
ColoniePortal
The ColoniePortal interface enables a script to be used as a colony portal. Colony portals can be installed on a colony. Anyone with a ship in the same sector can enter the colony's portal, and they will see the HTML output generated by the script. By adding forms to the output you can also have the guest enter data which will be available to the script when the form is submitted. See the Web interface on details how to generate output.
The interface provides a few variables exposing on which ship the portal is running, and the user and ship that entered the portal. It also seems to include everything the Web interface provides. However, it is recommended to also include the Web interface whenever you include this interface.
Registered variables
- MyColony As CMyColony
- This is the colony the portal is running on.
- GuestShip As CShip
- This is the ship that the guest entered the portal from.
- GuestUser As CUser
- The user who entered the portal.