Download
The language uses a simple C-like syntax and a command line tool to compile the code.
It also includes a User Defined Language file for notepad++ to give syntax highlighting and autocomplete of function calls.
Unlike with normal script files, you dont need to separate out each function call on a separate line and can combine them
Compiling Code:
Code: Select all
XScript.exe --load_data Data/XScript_X3FL.dat --compile script.XScript --out my.output.script.xml
Decompiling Code:
This will convert an existing script file so you can start editing it
Code: Select all
XScript.exe --load_data Data/XScript_X3FL.dat --decompile my.script.file.xml --out decompiled.XSript
Building new Data File:
The data file contains all the information about functions as well as all the game data like wares, commands, ship/station types, etc
To create a new data file you need to create an xml file which defines all these entries.
There is a data file for X3FL already included, and the xml file it was created from "xml/x3fl.xml"
Code: Select all
XScript.exe --build_data xml/x3fl.xml --out XScript_X3FL.dat
Generating notepad++ UDL.
If you need to include new function and other types for use with notepad++ auto complete. You can generate it based on a data file
Code: Select all
XScript.exe --load_data XScript_X3FL.dat --exportudl
And the xscript.xml which is the auto complete file to go with it. This goes in Program Files/Notepad++/autoCompletion
NOTE: this is currently an early experimental version. The included function names have been auto generated, so will eventually change to use better names
To setup the script parameters like the arguments, version number, etc. You can use build in function calls
Code: Select all
SetArgument($a.ship, "a ship object", SHIP);
SetArgument($a.station, "a station object", STATION);
SetVersion(1);
SetDescrpition("this is my script file");
Planned future features:
- Increment/Decrement symbols ($variable++, $variable--)
- Renaming all function calls
- Local scoped function calls
- #include preprocessor
- define preprocessor conditionals, #ifdef, #else, #endif
- reading of all scripts files in the game for better understanding of arguments and return types
- Full IDE for writing and building script files and whole projects
- Function Macros
- Function Overrides (multiple functions with same names but different arguments
- Support for CallName vs String in script call functions
- Extracting game data when generating data file
- Improvements to various warning messages
Example 1:
To set a ships position based on another object
Code: Select all
$ship->setPosition($object->posX(), $object->posY(), $object->posZ());
Getting random item from array (ignore the existing function to already do that in FL)
Code: Select all
$value = $array[random($array->size())];
Using Functions and arrays within Expressions
Code: Select all
$value = $array[($i * 10) / 2] * random(20);
Conditional
Code: Select all
if ($random(100) > 10 && $array[10] != 2) {
...
}