Author Topic: ENs - EUO to LUA Converter written in LUA  (Read 75352 times)

0 Members and 1 Guest are viewing this topic.

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
ENs - EUO to LUA Converter written in LUA
« on: October 16, 2010, 05:32:07 PM »
0
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

There are 2 attachment(s) in this post. You must register and post an acceptable introduction to download
ens_subs_euo_commands.lua
euo to lua translator2.lua
« Last Edit: August 29, 2012, 07:12:54 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #1 on: October 16, 2010, 05:32:24 PM »
0
* reserved *
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #2 on: October 16, 2010, 05:54:48 PM »
0
OK the salivating glands have kicked in !!

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
drooling_homer-712749_gif2-150x150.png

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #3 on: October 16, 2010, 06:17:11 PM »
0
Drool.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
DroolSpikeYuck.JPG

Scrripty

  • Guest
Re: ENs - EUO to LUA Converter written in LUA
« Reply #4 on: October 16, 2010, 06:37:59 PM »
0
I'll love you if it works. :)  Will help a ton with some "problem" scripts I'm working on. heh

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #5 on: October 16, 2010, 07:07:13 PM »
0
I'll love you if it works. :)  Will help a ton with some "problem" scripts I'm working on. heh


quote ow it works... post me a script here you want me to test...
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: ENs - EUO to LUA Converter written in LUA
« Reply #6 on: October 16, 2010, 07:38:50 PM »
0
My scripts will probably break things.  You're welcome to use my namespace conversion routines.  I've vetted those pretty well with the CLAw conversion.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: ENs - EUO to LUA Converter written in LUA
« Reply #7 on: October 16, 2010, 07:40:21 PM »
0
How about the monster id gatherer?  If it converts that it works great... got the list subs in it...

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #8 on: October 16, 2010, 07:51:06 PM »
0
My scripts will probably break things.  You're welcome to use my namespace conversion routines.  I've vetted those pretty well with the CLAw conversion.

I dont know we will have to see .. 

I was going to ask if i could include some of your converted work into the coverter..
it it using a menu   dofile(tms_menu) at top then auto generate your function code.
finditem , journal etc...

this way 98% conversion can be achieved...
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: ENs - EUO to LUA Converter written in LUA
« Reply #9 on: October 16, 2010, 08:37:12 PM »
0
You betcha!  Use away!
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #10 on: October 16, 2010, 08:39:08 PM »
0
You betcha!  Use away!

cheers :)   -- alot of work done on this already.. getting thier
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline Tidus

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +151
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Re: ENs - EUO to LUA Converter written in LUA
« Reply #11 on: October 16, 2010, 09:56:22 PM »
0
So let me get this straight (because i'm lost.. as usual) you run this script and it converts the file you want to LUA from EUO?

« Last Edit: October 16, 2010, 10:31:10 PM by Endless Night »
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #12 on: October 16, 2010, 10:31:21 PM »
0
Quote
So let me get this straight (because i'm lost.. as usual) you run this script and it converts the file you want to LUA from EUO?


yes .. when i post the LUA script you will be able to run it .. point to a EUO file and it will convert it to LUA. not 100% but as close as i can get to minimize editing.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline Superslayer

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #13 on: October 17, 2010, 04:18:26 AM »
0
Here's a few subs to try out and share here!

Code: [Select]
Sub Open_Container
; %1 = container Id
; %2 = gumpwait arg 2
; %3 = gumpwait arg 3
; %4 = contpos X
; %5 = contpos Y
set %ContId %1
Reopen:
set #lobjectid %ContId
event macro 17 0
GoSub gumpwait NULL %2 %3
if #result = #False
  goto Reopen
contpos %4 %5
Return


; %1 = GumpWait
; %2 = Gumpname 1
; %3 = Gumpname 2
Sub GumpWait
  wait %Mwait
  set %timedelay #SCNT
GumpWait_loop1:
  if #CONTNAME = %2 || #CONTNAME = %3
    Return #true
  if #SCNT > %timedelay + 7
    Return #false
  goto GumpWait_loop1
Return

Offline Endless NightTopic starter

  • Global Moderator
  • *
  • *****
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: ENs - EUO to LUA Converter written in LUA
« Reply #14 on: October 17, 2010, 06:51:23 AM »
0
The Translation at the current level of working

Code: [Select]
dofile('EN's_EUOCommandLibrary.lua')

function Open_Container()
 -- %1 = container Id
 -- %2 = gumpwait arg 2
 -- %3 = gumpwait arg 3
 -- %4 = contpos X
 -- %5 = contpos Y
g_ContId=arg[1]
Reopen:  
UO.LObjectID=g_ContId
UO.Macro(   17, 0)
gumpwait(NULL, arg[2], arg[3])
if #result== false then
  --GOTO Reopen  --ERROR: GOTO -not supported:  
EUO_ContPos( arg[4], arg[5])
return  
end


 -- %1 = GumpWait
 -- %2 = Gumpname 1
 -- %3 = Gumpname 2
function GumpWait()
  wait( g_Mwait)
  g_timedelay=#SCNT
GumpWait_loop1:  
  if UO.ContName== arg[2] or UO.ContName == arg[3] then
    return true
end
  if #SCNT> g_timedelay + 7 then
    return false
end
  --GOTO GumpWait_loop1  --ERROR: GOTO -not supported:  
return  
end

#Scnt - currently untransaltable.. but i will write a function for it. GOTO never transalateble must be replaced with a repeat..until, while or for structure.

NOTE: multiple returns in the sub... eventually i will have code that spews errors on this..  currently it produces bad code..  multi returns convert to return - end .. which will make you code not function as intended.
« Last Edit: October 17, 2010, 06:54:40 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Tags: