1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  4. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  5. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Jasshelper 2011-12-19

Discussion in 'Warcraft Editing Tools' started by cohadar, Dec 19, 2011.

  1. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    Small Bugfix 2012-02-06b

    Sneaky bug sneaked by me. :ogre_hurrhurr:
     
  2. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    Great, bye fugly module initializers.
     
  3. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    Add some docs on the new preprocessor directives (#bigdef for example).


    It would be really nice if you could nest macro calls

    Code (vJASS):

    //! textmacro boo
        //! runtextmacro hi()
    //! endtextmacro
    //! textmacro hi
    //! endtextmacro
     


    modules with parameters (something vex has been planning but has yet to do).
    module Init takes ho, boo, yo

    implement Init(x, y, z)



    Also, it would be excellent if you assumed that all code inside of an external block was Lua so that we wouldn't need the mass //! i anymore. Typing that all out is annoying as hell, so please.


    After those, I think this tool'll prob be good to go ^)^.


    Also, it'd be cool if the vjass optimizer removed inlined global constants ^)^.
     
  4. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    CPP preprocessor has been removed due to lack of public support.

    No it would not, it would be ugly and dangerous. This will never happen.

    Useless.

    Learn to use notepad++ regular expressions.

    This is a job for optimizer not for the compiler.
    It is much more useful to see names in map script than random numbers when some error happens.

    ================
    The thing I have on schedule next is optimizing function interfaces.
     
  5. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    uh... Vexorian has been planning modules that take arguments this whole time and has yet to do it. It's really not useless at all >.>. There have been many cases where modules with args would have helped me a lot.

    About as ugly and dangerous as recursive function calling?
     
  6. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    The function InitGlobals for GUI globals variables is called after the vJass initalizers in the function main.
    I don't see a good reason for it.
    Don't take me wrong, i have not used GUI since years, and i don't like it since the same time.
    But you are unable to use a GUI global value inside a vJass initializer, since its value is not currently defined in such initializers, and will be erased when InitGlobals will be called.

    The only reason i see with it so far, it is for fuck up GUI users.
    Indeed, just leave some global array with index max 8192 in the variable editor (one or two is probably enough) and then all GUI triggers will never be created, because limit op will be reached before GUI initializers calls, when InitGlobals will fire.

    If we want to keep this kind of "feature", we still have the hook DoNothing.
     
  7. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    Nice try, but I don't hook that easily.
    The comparison is without meaning and you know it.

    This never crossed my mind because I don't use GUI variables.
    GUI mappers are valid users of jasshelper, I have no intention of breaking anything for them by changing things without good reason.
    This will go under the "investigate" in the TODO list.

    PS: if you really need to set GUI variables in scope or library initializers you can always set them after TriggerSleepAction(0.0)
     
  8. Luorax

    Luorax

    Joined:
    Aug 7, 2009
    Messages:
    1,301
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Nice compiler, however here's one thing: in larger maps, JH quite often pops up a "memory exhausted" error message - I tend to use huge lua blocks to generate item objects (which comes as an item + an abil with multiple level). So, do you have any plans for it?

    Also, you've fixed the init order - does it mean if I replace my old JH with this one I'll have to rewrite everything, or old things would still work? (Soz for being lame, I'm kind of tired right now, it's too late here >.<)
     
  9. Frotty

    Frotty

    Wurst Reviewer

    Joined:
    Jan 1, 2009
    Messages:
    1,476
    Resources:
    11
    Models:
    3
    Tools:
    1
    Maps:
    5
    Tutorials:
    1
    Wurst:
    1
    Resources:
    11
  10. watermelon_1234

    watermelon_1234

    Joined:
    Nov 18, 2007
    Messages:
    1,066
    Resources:
    10
    Spells:
    9
    JASS:
    1
    Resources:
    10
    The latest version broke SpellEvent; it considers
    InitTrigger
    as an
    InitTrig
    function.
    It pretty much disallows any function beginning with
    InitTrig
    in scopes and libraries.
     
  11. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,193
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    To add to a growing list, having functions like InitBlizzard, CreateAllUnits, InitGlobals called by ExecuteFunc would help distribute the workload of the "main thread".
     
  12. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    Fixed SpellEvent library issue 2012-02-07
    Once again watermelon_1234 saves the day. :)

    I had many fears when I started working on init order that it would break everything, but as it turns out 99% of the maps will not need any changes.

    If there is anything you need to rewrite jasshelper compiler will tell you about it, and it is only renaming jobs so it is all easily done in 2 min.
     
  13. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    //! import "luajass.WmW_Masters.j"


    considering imports don't work, I can't use this -.-, soooo gg


    and you can't read GUI vars from JASS...


    and the entire main function is now broken.. it gave me undeclared function InitSounds()... seriously?
     
  14. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    Nice of you to report it.

    It is only in Init triggers, in spells you can use them all you want.
    Blame Vex for this, not me. (I am trying to find a solution atm)

    This is an example of a bad bug report.
    Please post a demo map with a bug.


    EDIT:
    It seems all your bugs are chained to be bad //! import
    working on a fix....
     
  15. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    The map I put it into contains masses of code, so I don't know what caused it ; P. All I know is that main doesn't work, lol.

    hm? I couldn't read them inside of an onInit method for a vjass struct? they work in official jasshelper just fine?


    lol, one of the ways I used to help cjass peeps find a lot of bugs is that I'd try to compile my huge system library with it to see if any bugs popped up : P. The map I put this into doesn't have as many resources in it as my system lib map does ^)^, but it still found quite a few bugs ;p.
     
  16. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    No, they don't.

    jasshelper 0.A.2.B
    Code (vJASS):

    //===========================================================================
    function main takes nothing returns nothing
        call SetCameraBounds(- 1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
        call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
        call NewSoundEnvironment("Default")
        call SetAmbientDaySound("LordaeronSummerDay")
        call SetAmbientNightSound("LordaeronSummerNight")
        call SetMapMusic("Music", true, 0)
        call InitBlizzard()

    call ExecuteFunc("jasshelper__initstructs15888592")  // <----------<<


        call InitGlobals()    // <----------<<
        call InitCustomTriggers()
        call RunInitializationTriggers()

    endfunction
     


    current jasshelper:
    Code (vJASS):

    //===========================================================================
    function main takes nothing returns nothing
        call SetCameraBounds(- 1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
        call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
        call NewSoundEnvironment("Default")
        call SetAmbientDaySound("LordaeronSummerDay")
        call SetAmbientNightSound("LordaeronSummerNight")
        call SetMapMusic("Music", true, 0)
        call InitBlizzard()

    call ExecuteFunc("jasshelper__initstructs1260") // <----------<<

        call InitGlobals() // <----------<<
        call InitCustomTriggers()
        call RunInitializationTriggers()

    endfunction
     


    GUI variables were always initialized after jass stuff.
    I could change that but I am not yet sure if I should.

    Like I said earlier all your bugs are just 1 bug - from error in importing section.
    If map has no //! import everything works just fine.

    While you wait for a fix you might be interested in this:
    http://www.wc3c.net/showthread.php?p=1133730
     
  17. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    The fix for being able to use GUI variables in jass initializer is easy, call InitGlobals before vJass initializers, and not the opposite like actually.

    But you will still not safely be able to use a GUI variable like that :

    Code (vJASS):
    globals
        integer I = udg...
    endglobals


    Because if i remember correctly, the "default" value given in the variable editor is applied only when InitGlobals is called, that's how the variable editor handle them.

    It makes sense for a "sized" array, but not really for not array variables.
    Even if some native functions don't work or even make wc3 crash, if used in a global definition, like GetLocalPlayer (but i call it a bug)

    Also for not array variables, even if the user specify a default value in the variable editor, a "null" value will be given in the global definition according to the variablle type, and then the default value will be applied inside InitGlobals:

    Assuming udg_Bool default value is "true" :

    Code (vJASS):
    globals
        boolean udg_Bool = false
    ...
    endglobals

    function InitGlobals takes nothing returns nothing
        set udg_Bool = true
    ...
    endfunction


    I have not tested it since years though, that's just memories.
     
  18. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    no... my problem was that the GUI vars threw an error with yours. Your thing said that they did not exist :\.


    I'm working with preplaced rects on the map >.<
     
  19. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    Nestharus, keep off your ego and make good bug reports plz.
     
  20. cohadar

    cohadar

    Joined:
    Jun 16, 2007
    Messages:
    234
    Resources:
    0
    Resources:
    0
    2012-02-07b
    Fixed //! import directive

    Now about InitGlobals:

    When you use GUI variables editor to declare:
    1. integer x with value 123
    2. array a of length 8190

    this is what happens:

    Code (vJASS):

    function InitGlobals takes nothing returns nothing
        local integer i= 0
        set udg_x=123
        set i=0
        loop
            exitwhen ( i > 8190 )
            set udg_a[i]=0
            set i=i + 1
        endloop

    endfunction
     


    It is obvious why this is idiotic but there is nothing I can do here because that is code generated by blizzard not by jasshelper.

    If I call this before jass initializers there is a big chance that the game will crash due to OP overflow.

    I would need to wrap this in ExecuteFunc but than it could crash silently and you would never get an error report.

    I am still undecided what to do here....