SymbioteHandlersPlugin
Allows Symbiotes content to be constructed using alternate scripting languages
模組介紹 作者原文
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. A
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: