Convert inline ↔ standalone
This online converter helps you convert your script to inline and back to normal.
Additional help
Standalone scripts are saved in separate text files (file extension doesn't matter) and can be loaded via:
- <SCRIPT src="my_script.as" />
or (for build-time scripting inside VARIABLE):
- <SKIN build_time_script_include="build_time_helpers.as">
Standalone scripts don't require any "escaping" (replacing special characters).
Inline scripts can be used like this:
- // declare variables, classes and functions inside SCRIPT
- <SCRIPT script="int my_global_var = 123; void myFunction() { ... }; " />
- // write scripts in ACTION
- <ACTION id="myAction" type="Script" script="if (a < b) { doStuff(); }" />
- // execute scripts directly from ACTION_TRIGGER
- <ACTION_TRIGGER event_id="..." script="if (!blocked) { doStuff(); } " />
- // write render scripts for CANVAS
- <CANVAS render_script="doMyRender()" ... />
- // write render scripts for GL_OBJECT_3D
- <GL_OBJECT_3D render_script="my3DRenderScript();" ... />
- // write build-time scripts inside VARIABLEs
- <VARIABLE id="IS_WIN" script='return ("$_SYSTEM_TYPE_$"=="Windows")?"1":"0"' />
Inline you have to use special characters instead of ", <, &, and use only /* such comments */.
Notice, that if you use single quotes for the script (like in the VARIABLE example above), you can avoid escaping regular quotes, which if often very handy.
How to convert manually
To convert standalone script to inline you have to:
- replace < with <
- replace " with " (inside single quotes can be left untouched)
- replace ' with ' (if used inside single quotes)
- replace & with &
- instead of // comments use /* comments */
About converter
This online tool is in experimental state, though we use it a lot for our own projects. If you find any bugs in this converter, feel free to report.
Comments
Please, authorize to view and post comments.