wc3edit.net
https://forum.wc3edit.net/

[Solved] Jass comment breakes map
http://forum.wc3edit.net/deprotection-cheating-f64/jass-comment-breakes-map-t37089.html
Page 1 of 1

Author:  Orbry [ February 11th, 2020, 10:27 pm ]
Post subject:  [Solved] Jass comment breakes map

Hello everyone!

I've started studying jass recently and tryed to play with one russian protected RPG map. So I've learned how to get war3map.j out of it, could modify the script, put it back and all is good... except one weird thing. If I add any comment to .j file the map wont load, actually wc3 reforged wont even create lobby for that map, and if i remove comment it works :shock:

I've been googling for 2 days now, searching documentations or any similar cases but found nothing. Every man/doc says i can safely use single line comments "//", but i've also tryed "/* */" and "#" syntax from other languages, just in case, but neither did work, the map just wont work. Also I've tryed to narrow the problem by adding comments outside function bodies, inside, trying different spacings etc. It just seems if there is any comment at all in script, even trailing :!: , the map just wont work. :mad:

Afaik to create lobby game launches only config func, but even if the comment is in main func it wont create lobby, that fact suggests that the problem arises when jass is compiled into machine code. Btw you might say "well, weird, but just dont use comments" - you might be right, but the jass code is obfuscated and 22k lines long, takes time to understand it, and comments would really help a lot! :)

I've also created new map in WE, added simple trigger with comment, saved it, checked .j file - it had lots of comments and the map worked fine. I've tryed to copy comment from that new map but it didn't work either >_<
I've searched docs on w3x format, trying to find is there any kind of binary flag that disallows jass comments or enables some other "strict" mode but found none...

So I am a bit lost right now, if someone has any ideas whats the problem is I will be really glad to hear them :D
I've attached the map itself and listfile i used (i got it by scaninng map with ladik's mpq editor scan)

--edit
fixed typos

Author:  Orbry [ February 12th, 2020, 7:03 pm ]
Post subject:  Re: Jass comment breakes map

Well, if someone would just check whether you can add any comment to jass code in .j file and make the map work - that would already help a lot! At least I will know whether it's map issue or something is wrong with my environment

Author:  nuzamacuxe [ February 12th, 2020, 9:20 pm ]
Post subject:  Re: Jass comment breakes map

That's really weird... probably whenever you try to comment something it auto broke the script because the map can't load the configs in function config. It's just a bet.

Author:  tcml [ February 13th, 2020, 5:35 am ]
Post subject:  Re: Jass comment breakes map

I don't know anything about jass, cannot help you this case

Author:  Orbry [ February 13th, 2020, 7:19 am ]
Post subject:  Re: Jass comment breakes map

nuzamacuxe wrote:
That's really weird... probably whenever you try to comment something it auto broke the script because the map can't load the configs in function config. It's just a bet.

I had that same thought, but why would that happen? To make it more clear - I do not comment out any existing code, i just add new line with simple comment like "// test" and map refuses to make lobby. And it does not matter where comment is located - it can be outside of any function called in config func, but it still wont make lobby :roll:
And even if it was inside config func - it just should not matter, it is supposed to be ignored on code transpile! :mad:

tcml wrote:
I insert cheats and its works fine, anti-single player removed.

Uhm, thank you I guess, but that's not what I want. I actually want to deobfuscate map code and try to improve or add new features and propose them to map owner :D
Also I've checked the code of the map you have attached - not a single comment inside jass code, does not really help my question :)

Author:  nuzamacuxe [ February 13th, 2020, 9:44 am ]
Post subject:  Re: Jass comment breakes map

As I said, that's weird but I already saw maps acting like that. I just tried what I said and now I at least could create the map but it still broke. Why don't you just do a second war3map.j commented and let the original one "untouched" (you'll do the edits of course but won't comment anything on that one)? It's better since you would be able to do the edits without breaking the code.

Author:  Orbry [ February 13th, 2020, 10:08 am ]
Post subject:  Re: Jass comment breakes map

Yep, that's one way to avoid this problem but not the most comfortable and if I won't find solution guess I will take it.
But I am not done yet and really curious now why comments breake code :)
I have a couple ideas, will test them out when I have some free time ;-)

-- SOLVED --

Well, the reason for this glitch turned out to be quite trivial :lol:
After opening the script in hex i've noticed that instead of common \r\n or \n it had weird \r line endings, and after converting file to \r\n everything worked like a charm, can paste comments all over my face now :D

Author:  nuzamacuxe [ February 14th, 2020, 12:50 am ]
Post subject:  Re: [Solved] Jass comment breakes map

Nice! Little details which make difference. Good job.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/