Script - System Viewer

From FreeSpace Wiki
Revision as of 02:08, 8 May 2014 by Axem (talk | contribs) ("Show Orbit": No space here)
Jump to: navigation, search

The System Viewer is a LUA script that allows a modder to create a map that can be used for reference purposes or for in-game navigational purposes. The configuration files are done in JSON and I would recommend using this site to edit them.

This page will assist modders to install it, configure it, and use it.

Download Link

LINK

Required Files

All required files are included in the above download, including some sample files for demonstration and to inspire. The following files are the required files needed to make the script work if the modder wishes to remove the other files.

  • /config/
    • imonitor.cfg (if imonitor-sct.tbm is to be used)
  • /interface/
    • axui_box1.png
    • axui_cancel.png (+c and h variants)
    • axui_exit.png
    • axui_jumpto.png (+c and h variants)
    • axui_return.png (+c and h variants)
    • cb_sidetab.png (+c and h variants)
  • /scripts/
    • dkjson.lua [[1]]
  • /tables/
    • axui-sct.tbm
    • imonitor-sct.tbm
    • parsecfg-sct.tbm
    • sysviewer-sct.tbm
    • zLoadFirst-sct.tbm (written by Nuke)

Demonstration Files

  • /interface/
    • nav_asteroids.png
    • nav_node.png
    • nav_node_big.png
    • nav_orion.png
    • nav_planet_b.png
    • nav_planet_g.png
    • nav_planet_p.png
    • nav_planet_r.png
    • nav_planet_y.png
    • nav_planet_b.png
    • nav_star_b.png
    • nav_star_r.png
    • nav_star_w.png
    • nav_star_y.png
    • nav_sys_vega.png


Configuration Files

The system viewer requires 2 configuration files (3 if an out-of-mission interface is desired). These files must be placed in the /config/ directory.

Interface Monitor

imonitor.cfg is a JSON configuration file for imonitor-sct.tbm which allows the player to access different custom interface screens. Full documentation can be found in Script - Interface Monitor.

Campaign Configuration File

Used to decide which system config that gets loaded during a campaign.

System Configuration File

Contains all the information to draw systems

Campaign Configuration File

A file with the format

sysview_[CAMPAIGN_FILENAME]_config.cfg

placed in the /config/ folder will be loaded when the System Viewer starts. Eg: sysview_Freespace2_config.cfg. The file is a JSON file with 2 required fields.

"File":

This will tell the script which system file to look at and load.

"Default":

This will load the specified system that the script will load by default.

"[missionfilename].fs2":

This will load the specified system when the mission's filename matches the one being played (or to be played next if the script was activated in the mainhall screen)

"sm01-01.fs2": Vega1

System Configuration File

This file contains the information the script uses to draw the system.

"[Internal Name]"

Object. The name of the object that contains the system configuration is used internally to change to keep track of the different systems in the file

"Name"

String, the displayed name. Drawn in the upper left corner in large text

"Description"

String, a subtitle to the name. Drawn below name in slightly smaller text

"Background"

Filename, the background that will be used in the system viewer screen. The view will be bound to this image (so its a good idea to make this a large image).

"Elements"

Object, this contains all the visible elements the player can interact with.

"[Internal Name]"

Object, this contains all the information to draw this element. The object's name will be the internal name for this element. This will be the name that gets written to a SEXP variable, navsys_destination, if the modder is using this as a navigational system. If this element is named "Player" it will be moved to navsys_destination as well.

"Name"

String, the name that will be drawn below the bitmap.

"Visible"

Boolean, if true it will draw this element.

"Bitmap"

Filename, should be in a folder with other graphic files (effects or maps etc). This is the bitmap that will be drawn. The script will also attempt to use the filename plus _h and _c for highlighted and clicked graphics.

"LargeBitmap"

Filename, will be drawn in the middle of the screen if this element is clicked.

"ShipClass"

String, if LargeBitmap is absent and ShipClass has a valid ship class, a rotating tech room style model will be rendered when an element is clicked on.

"ShowOrbit"

Boolean, if true it will draw the circular orbit for this element. (Sorry, no elliptical or hyperbolic orbits!) Optional.

"Selectable"

Boolean, if true the player can click on the object which will bring up detailed information about this object. Optional.

"CanJump"

Boolean, if true the player can click a "Jump To" button if this was activated during gameplay. Upon clicking JumpTo, the internal name for the element will be written to the SEXP Variable, navsys_destination, if it exists. It will also close the viewer. Optional.

"ForceJump"

Boolean, if true and the player clicks the "Jump To" button, it will force the player to jump out, ending the mission. Optional.

"Orbits"

String, internal name of another element. This will cause this element to have its orbit centered on the specified parent's orbit.

"Orbit"

Object. Defining, in polar coordinate terms, where to draw the element. Optional, but leaving this out will cause the element to be drawn in the middle of the screen.

"Distance"

Integer, the orbital radius in pixels.

"Angle"

Integer, the orbital angle in degrees. 0 degrees is the direction to the right side of the screen and goes clockwise.

"Offset"

Object. Fine tuning a bitmap's placement. Optional.

"X"

Integer, this will move this object to the right by X pixels (negative values will move it to the left). This is in addition to the orbital distance and angle. (You could have two elements sharing the same orbital distance and angle, but have different offsets to place them differently)

"Y"

Integer, same as the X above, just for vertical placement.

"Icon"

Object. Draws a secondary bitmap over the element. Optional.

"Bitmap"

Filename, graphic file to be drawn

"X"

Integer, x coordinate of where the bitmap will be drawn relative to the top left of the element's bitmap. Two special values, "-" and "+" can be used instead to automatically move the icon to the left most or right most part of the element's bitmap.

"Y"

Integer, same as X above, just for vertical placement.

Using In-Game

TO-DO...