goshante / cjass2lua

Code converterter from cJass and JASS to Lua for Warcraft III
GNU General Public License v2.0
1 stars 2 forks source link

How to use that? #4

Open PaienNate opened 1 year ago

PaienNate commented 1 year ago

Sorry for asking this stupid question, I find your project from jass2lua. For jass2lua I should put the map into its program, then run the new map; for this tool, how should I use the lua file now? And by the way it's just support forged version, not japi like jass2lua?

goshante commented 1 year ago

Greetings! To use that you have to save every single trigger code text of your map as separate .j text file. Just copy/pase content of each of your trigger into corresponding text files, save them and specify path to this folder. If your scripts is valid they have to be translated pretty easily. For more Info you can check readme file. This tool can process only raw text files. Direct w3x map is unsupported. You have to re-insert converted code into your map by yourself.

PaienNate commented 1 year ago

So it's not designed for old map just have "war3map.j"? I am trying to fix an old map's bug from 2006, it delete the trigger file used for WE, so I just can find war3map.j in script folder.

goshante commented 1 year ago

@PaienNate You can try war3map.j file too, sometimes it have problems with that, but for my maps this tool worked perfectly. Just extract it from the map and let program to do it's job. But if you deal with obfuscated code the output very likely would be unreadable too. I never tested my tool with obfuscated code. At least when I created this tool it was designed both for vanilla JASS and cJASS.

But remember that it works only with directories with multiple text files -> another directory with corresponding output files or single text files to single text files. It does not converts your w3x map to lua-based map. This is a helper tool for developer to do dirty job for you, but you have to handle results on your own (Editing, polishing, embedding into your map).

If you converting entire war3map.j you have to change map script language to lua in the editor. After that remove all JASS code and replace it with generated lua code. If it has problems try pasting it piece by piece, edit and debug untill it works as it was before.

For optimizing code after converting to lua I also advice to remove all warcraft api-related hash table calls and use raw and simple lua tables instead. If you leave WC3 hashtables they will still work but in lua they are highly ineffective, obsolete and redundant.