EN's EUO2LUA Converter
I have been working on this script since shortly after Cheffe killed EUO, prior to resurrection. It has helped me learn alot about LUA and alot about EUO !!!
About this script:
Converts EUO script into LUA script. The resulting script needs 'ENs_EUOCommandsLibrary.Lua'. Thier are of course limitations, not everything is convertable. The main issues that are unconvertable via automated processes at this time are:
- gotos and goto lables.
- execute
- Continue
The Script output needs to be examined.. a number of commands are now obsolete or unconvertable, after conversion search for --ERROR: for known issues and examine the script in general for correctness. (Many features of EUO although converted can be better written in native LUA - the Library file just allows for automated conversion not nessacarily the best way to structure your code.. but only a human can make those decisions.)
How To Use:
Edit the last line of the script, repalceing the dummy filename with the filename of the script you want transalted (instructions in script). The transalted script will have the same name with the addition of .LUA
What it does
- Saves you masses of edit time.(Translates an 8500 line script in under 15 seconds.)
- Produces real lua code that will run (exceptions below)
- Converts all EUO commands and variables except listed below.
- Converts EUO wait times to LUA wait times. (*50)
- Auto fixes split lines (+)
- Auto adjustment for code after a condtion not in a code block{}, ie a single line. Commands applies to IF,For,While, CMPPIX,OnHotKEy (Does not fixed nested bad blocks.. ie if x=y if x=z if x=q set x=0 but EUO didnt function correctly on this anyway.
- Moves code pre first function definition to buttom of script
- Add comment blocks for library includes, function definitions and script body
- Correctly translates multi-return subs.
- * Vars translated as setatom, getatom (Not as registry entries)- under assumption that this is mainly used for inter-script communication. (note no persistence)
- ERROR marks goto statments so you can manually fix (GOTO GotoLabels:).
- Removal of final (function end) returns that have no return value.
- Automatic conversion of non-numeric data to strings.
NOTES/TODO List
NO OpenEUO Equivalents Commands: Probable Obsoleteness to be determined by Cheffe
shutDown, execute, Menu HideEUO, PLAYCD, STOPCD, #LPC, LinesPerCycle
CURRENTLY NOn-functional until Cheffe implements commands:(empty library functions created)
EUO_Send, EUO_Sound, EUO_UOXLNew
No OpenEUO Equivalent Vars: Initializied in Library but hold no real meaning.(EUO_varname)
#CurPath, #PathSCR, #PathLIB, #PathTMP, #PathEXE, #PathDAT, #OPTS, #OSVer, #EUOVer
ENs EUO Command Library--unCompleted functions
#findmod, EUO_NameSpace(6 Commands), EUO_menu(37 Commands)
Other Issues yet to be addressed:
-processing of % . !xx % . test 56 % 78
-concatination of strings via , (not working inside gosub xx dfd , fdfd ,dfd ,dfdf also
if "Lower" .. " " .. "Reagent" .. " " .. EUO_In( "Cost", EUO_Property) then
-- Call ... <> dofile as parameters can be passed thierfor untranslatable.
-set !Parameters transaltes as Parameters = should be nil
-repeat .. until .. use of {} inside... this creates an extra end prior to the until.
-no support for if x=y 2
-Every Function is called with EUO_Result = function(), even if the function returns no value.
-Most command Executes used are to store data .. this can be replaced with file handle commands. (execute and echo )
- GOTO exception: if one goto per lable and both reside in the same space as if were - potentially convertable
-examine saving * vars in an ini file .. for reading/writing to make persistent.
- ABS not correcly converting in every scenario if abs ( x -y ) results in if math.abs( () x - y )
- issue with finditem translation and "C_ ," translating as "C_",..,
- Test TerminateEUO function for correctly working if UO clients still open.
-DisplayResult - results are in capitals theirfor if #DisRes = yes .. converts to displayresult = 'yes' never true as returns 'YES' not 'yes'
Major(Bold)/Minor Beta Testers
SuperSlayer, Dixie Wrecked, Chrome