Starfield

File information

Last updated

Original upload

Created by

stonegdi

Uploaded by

stonegdi

Virus scan

Safe to use

Tags for this mod

About this mod

Script Extender plugin exposing a very lightweight and simple API allowing to control the game via a web console or any HTTP client. Configuration allows console output to be redirected to file (as with my other mod) but also allows to create an API that can be called using any HTTP client, or alternatively you can use the web console provided.

Requirements
Permissions and credits
Changelogs
NEW IN V2

New features:

  • Command history simple navigation
  • Customizable quick commands (via JSON file)
  • New stream mode for continuous output flow
  • Single click output clipboard copy
  • Bug fixes and clean-ups

DESCRIPTION

This mod is a Script Extender plugin containing two main features:

  • Write all untruncated console output to file
  • Expose a HTTP POST API endpoint "/console" allowing to run commands

REQUIREMENTS

You must have Starfield Script Extender installed and working before you can use this mod.

NOTE: If you want to avoid the game pausing while Alt+Tab'ing to another window you can add this to your StarfieldCustom.ini:

[General]
bAlwaysActive=1

Alternatively, you can run this console command:

SetINISetting "bAlwaysActive:General" "1"

TROUBLESHOOTING

Confirm you have a listening endpoint - you can run this command (must be within an admin command prompt):
for /f "tokens=2" %i in ('tasklist /NH /FI "IMAGENAME eq Starfield.exe"') do netstat -ano | findstr %i

A normal output would be something like this, showing the listening endpoint:
TCP 127.0.0.1:55555  0.0.0.0:0  LISTENING 36896

If you are using the web application, you can open the developer console (F12) and look for any errors.

FEATURES

Dynamic reloading of the plugin's configuration is possible using a custom plugin specific console command:

sfse_plugin_console_api_reload_config

You can also view the currently active plugin configuration using this custom command:

sfse_plugin_console_api_dump_config

NOTE: You can update the plugin configuration file while the game is running and use the command above to reload the plugin configuration for the changes to take effect immediately.

FILES

The plugin library file, the configuration INI and the plugin log file for troubleshooting issues:

<GameFolder>\Data\SFSE\plugins\sfse_plugin_console_api.dll
<GameFolder>\Data\SFSE\plugins\sfse_plugin_console_api.ini
%USERPROFILE%\Documents\My Games\Starfield\SFSE\Logs\sfse_plugin_console_api.log

If you enable console text output to file (this is configurable - see configuration lower below):

%USERPROFILE%\Documents\My Games\Starfield\SFSE\Logs\sfse_plugin_console_output.log

If you installed the web application and you want to serve static files (this is configurable - see configuration lower below):

<GameFolder>\Data\SFSE\plugins\sfse_plugin_console_web\*

API ENDPOINT

The plugin includes a very lightweight HTTP server with a single POST /console endpoint that the web app is using, or alternatively you can use any HTTP client or even the console with curl:

C:\>curl -X POST -d "GetSFSEVersion" http://127.0.0.1:55555/console
GetSFSEVersion
Command: GetSFSEVersion
SFSE version: 0.1.3, release idx 4, runtime 01070210

CONFIGURATION FILE CONTENT

[Plugin]
bEnableFileOutput=false
bEnableWebConsole=true

[FileOutput]
bOverwrite=true
sPath=%USERPROFILE%\Documents\My Games\Starfield\SFSE\Logs\sfse_plugin_console_output.log

[WebConsole]
iExecTimeout=100
sHost=localhost
iPort=55555
bDisableCORS=false
bDisableStaticFiles=false
sStaticFilesPath=Data\SFSE\plugins\sfse_plugin_console_web\

CONFIGURATION DETAILS

[Plugin] section:

  • bEnableFileOutput: enable/disable the output of all untruncated console text to file
  • bEnableWebConsole: enable/disable the API endpoint

[FileOutput] section:

  • bOverwrite: true to overwrite the output file everytime time the game is started, false to keep the output file content
  • sPath: the file path where to save the console text output to (you can use environment variables)

[WebConsole] section:

  • iExecTimeout: this is how long (in milliseconds) the plugin waits for the console output after the last line was captured
  • sHost: the hostname or IP address to bind to for the API endpoint (localhost or 127.0.0.1 is recommended)
  • iPort: the port to use for serving the API endpoint (make sure the port you specify is unused)
  • bDisableCORS: enable/disable Cross-Origin Resource Sharing (CORS) - essentially for developers so a separately hosted web app can be used
  • bDisableStaticFiles: enable/disable serving of static files (i.e. the web application files) - disabling this will turn off the web application while keeping the API endpoint untouched
  • sStaticFilesPath: thhe path where the web application files are located (i.e. the static files)

SOURCE CODE

sfse_plugin_console_api
sfse_plugin_console_web


[/the_end]