LordAshes-SymbioteHandlersPlugin icon

SymbioteHandlersPlugin

Allows Symbiotes content to be constructed using alternate scripting languages

Last updated a year ago
Total downloads 396
Total rating 0 
Categories Tweaks Tools Integration
Dependency string LordAshes-SymbioteHandlersPlugin-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

bbepisTaleSpire-BepInExPack-5.4.10 icon
bbepisTaleSpire-BepInExPack

Unified BepInEx all-in-one modding pack - plugin framework, detour library

Preferred version: 5.4.10
brcoding-SetInjectionFlagPlugin-2.3.0 icon
brcoding-SetInjectionFlagPlugin

Allows players to flag mods are installed

Preferred version: 2.3.0

README

Symbiote Handlers Plugin

This unofficial TaleSpire plugin allows the content of Symbiotes to be constructed using alternate scripting languages such as PHP or Python.

Change Log

1.0.0: Initial release

Install

Install using R2ModMan.

Comes with a sample Symbiote that uses PHP to construct the Symbiote page.

Usage: Configuration

Before the plugin can provide any benefit it needs to be configured with one or more handlers. Handlers mappings between file extensions and scripting interpreters. For example, the PHP extension can be associated with the PHP interpreter while PY extension can be associated with the Python interpreter.

To do this use R2ModMan to edit the config for the plugin. The handlers property is a JSON dictionary which maps extensions to handlers. For example:

{
  "PHP": "php.exe -f {*}"
} 

The {\*} characters are replace with the script file name.

Usage: Symbiote Building

When building a Symbiote using this plugin, the EntryPoint in the manifest is not the script file, it is a HTM or HTML file with the same name except for the extension. This is important. The Symbiote will not work correctly if it points directly at the script file.

The entry point typically the HTML code for to display if the user does not have the plugin or appropriate handler installed.

The script is then placed in a file with the same name as the EntryPoint except the extension, instead of HTM or HTML, reflects the script language.

When the Symbiote requests the EntryPoint, the plugin intercepts the requests and checks to see if the requested page has a corresponding script file asscoated with one of the configured handlers. If so, the script file is executed and the results of the script are written to the requested file. This allows the alternate scripting language to create the Symbiote content dynamically.

For example, consider the plugin having a configured handler for PHP and Python. The Symbiote makes a request for the EntryPoint URL which, in this exmaple, is test.html. The handler would look to see if it can find a test.php file (PHP being the extension configured for the PHP interpreter) and also look for a test.py file (PY being the extension configured for the Python interpreter). If it find either of these files, it executes them and overwrites the test.html file with the output of the script results.

If the test.html initially started with HTML for indicating that it needs PHP and this plugin to work, that is what would be displayed if the user tried to use the Symbiote without having this plugin or without having a PHP interpreter properly configured.

Otherwise the contents of the scripting file is passed to the corresponding scripting interpreter and the results would overwrite the test.html. In such a case the Symbiote would end up displaying the results of the script file.

Limitations

The handler process is limited to loading of the EntryPoint (the Symbiote). If the Symbiote code load additional files, these files will not have been processed though the handler. For example, a link in the Symbiote page would not have the benefit of the handler. As such, when the script handler is triggered via the EntryPoint, it needs to run any additional scripting file though the interpreter on its own.

The handlers can use with any scripting interpreter that supports input of a filename and produces output (or can produce output) to the console (standard output). This is necessary for the plugin to be able to capture the results and write them to the requested file.

This plugin allows alternate language scripting for building the Symbiote content but since it is executed on Symbiote load, it is not intended for processing the Symbiote. For example, the alternate scripting language can be used to easily create 25 butttons on the screen and even speify the javascript function to be called when these buttons are pressed but the alternate scripting language cannot be used to actually process the button clicks. At most the alternate scripting language can be used to construct the javascript response function.