--scriptonly

tooltiperror

Super Moderator
Reaction score
231
Alright, while reading JassHelper Manual, I was paying specific attention to the Terminal and Commandline flags. I noticed --scriptonly, and it allowed you to get an external output.j file. In other words, this:

JASS:

//input.J
 function main takes nothing returns nothing
 endfunction

 library HolyMoly
   struct Data
      integer x
      real y
   endstruct
 endlibrary


Becomes:

JASS:

//output.J
globals
//globals from HolyMoly:
constant boolean LIBRARY_HolyMoly=true
//endglobals from HolyMoly


//JASSHelper struct globals:
constant integer si__Data=1
integer si__Data_F=0
integer si__Data_I=0
integer array si__Data_V
integer array s__Data_x
real array s__Data_y

endglobals


//Generated allocator of Data
function s__Data__allocate takes nothing returns integer
 local integer this=si__Data_F
    if (this!=0) then
        set si__Data_F=si__Data_V[this]
    else
        set si__Data_I=si__Data_I+1
        set this=si__Data_I
    endif
    if (this>8190) then
        return 0
    endif

    set si__Data_V[this]=-1
 return this
endfunction

//Generated destructor of Data
function s__Data_deallocate takes integer this returns nothing
    if this==null then
        return
    elseif (si__Data_V[this]!=-1) then
        return
    endif
    set si__Data_V[this]=si__Data_F
    set si__Data_F=this
endfunction

//library HolyMoly:

//library HolyMoly ends
 function main takes nothing returns nothing

call ExecuteFunc("jasshelper__initstructs2036")

 endfunction



//Struct method generated initializers/callers:

function jasshelper__initstructs2036 takes nothing returns nothing


endfunction


this.

Of course, this is super, because it would mean I would be able to simply convert my vJASS into simple JASS. However, the problem is, it creates a lot of globals that I would have to manually create, then I would have to add the udg_SUFFIX to them. Does anyone have ideas for a work around?
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Wait--
You mean to say that if I were to code my spells like that, I can create vJass spells with Jass?

Sounds good..
But that's really messy to look at ._.

And what's that executeFunc doing there?

Is that how our structs and stuff are compiled when we save? o.0
And..

Why do you want to convert your vJass into simple Jass?
 

Bribe

vJass errors are legion
Reaction score
67
Yeah, any MPQ extractor will let you view war3map.j files. I've viewed them all the time to see what I can optimize (like how functionName.evaluate() actually creates an entire trigger - I do NOT want!)

Using NewGen is preferred as was listed above. Vex has stated many times that nothing is possible in vJass that can't be done in JASS, it's just, as you've seen, far more user-friendly to code in vJass. and without the horrific udg_ prefix.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
However, the problem is, it creates a lot of globals that I would have to manually create, then I would have to add the udg_SUFFIX to them. Does anyone have ideas for a work around?
Well, you can decompress your map and manually edit the map script, moving all the global declarations to the one [lJASS]globals[/lJASS] block at the top. In fact, some of the variable type you can declare in JASS (eg. [lJASS]triggercondition[/lJASS]) are not available in the World Editor anyway, so you wouldn't even be able to create udg_ versions of them.

I don't think this method is very practical; it's much better to just run JassHelper directly on the map and let it handle things.
 

tooltiperror

Super Moderator
Reaction score
231
I suppose you are right. But would moving the [ljass]output.j[/ljass] into the Map's MPQ cause it to work?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
No, WC3 only uses the one war3map.j file.
 

tooltiperror

Super Moderator
Reaction score
231
That's strange, then how does NewGen parse the globals?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
"The JassHelper preprocessor will simply merge all the global blocks found around the map script and move them to the top of the map, all merged in a single globals block." [source]
 

tooltiperror

Super Moderator
Reaction score
231
Well is there a way to take ours and move them into the top? With an injection of some sort?
 

Bribe

vJass errors are legion
Reaction score
67
The injecting capability of NewGen is the reason that it gets flagged as a virus when everyone downloads it :p
 

tooltiperror

Super Moderator
Reaction score
231
I know, but I'm saying, how can I replicate that injection? Is there a way I can edit an MPQ?
 

tooltiperror

Super Moderator
Reaction score
231
I was wondering if there was a way to do it automatically.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
That's what JassHelper does. ;)

I suppose you could write your own program, say in Java, to do so. You still wouldn't be able to save your code directly into the map using the World Editor, because the syntax checker would give errors (either missing globals, or unexpected global blocks) and prevent saving, unless you commented out all the code and then made your app automatically uncomment everything...
 

tooltiperror

Super Moderator
Reaction score
231
It appears that is what it will have to do :) It can comment out comments, but not comment double comments. I think I'll make it so that it compiles what I call iJASS to vJASS to Vanilla JASS.

Or perhaps I should just make a tool to automatically inject output.j into a map.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top