Scripting:Interfaces

From STNE Wiki

Jump to: navigation, search


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.
Personal tools