1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[WIP] Automatic dependency importer in vJASS

Discussion in 'Warcraft Editing Tools' started by Deleted member 219079, Jul 28, 2016.

?

What would you like me to focus on?

  1. Add support for TheHelper.net

    0 vote(s)
    0.0%
  2. Fix bad behavior (please post comment)

    0 vote(s)
    0.0%
  3. JNGP Integration

    0 vote(s)
    0.0%
  4. //! fetch - preprocessor command (same as imports)

    0 vote(s)
    0.0%
  5. This tool doesn't need anything else (casual bug fixing)

    0 vote(s)
    0.0%
  1. Example

    Code (vJASS):

    library TimedEffect

        imports Alloc
        imports TimerUtils
     
        private struct Stack extends array
            implement Alloc
            effect e
        endstruct
     
        private function OnExpire takes nothing returns nothing
            local timer t    = GetExpiredTimer()
            local Stack s    = GetTimerData(t)
            call DestroyEffect(s.e)
            call s.deallocate()
            call ReleaseTimer(t)
            set t            = null
        endfunction
     
        function DestroyEffectTimed takes effect e, real delay returns nothing
            local Stack s    = Stack.allocate()
            set s.e            = e
            call TimerStart(NewTimerEx(s),delay,false,function OnExpire)
        endfunction
     
    endlibrary
     

    Becomes:
    Code (vJASS):

    library TimedEffect requires Alloc, TimerUtils
     
        private struct Stack extends array
            implement Alloc
            effect e
        endstruct
     
        private function OnExpire takes nothing returns nothing
            local timer t    = GetExpiredTimer()
            local Stack s    = GetTimerData(t)
            call DestroyEffect(s.e)
            call s.deallocate()
            call ReleaseTimer(t)
            set t            = null
        endfunction
     
        function DestroyEffectTimed takes effect e, real delay returns nothing
            local Stack s    = Stack.allocate()
            set s.e            = e
            call TimerStart(NewTimerEx(s),delay,false,function OnExpire)
        endfunction
     
    endlibrary

    //! import "(...)\vjassimport\libs\wc3c.Vexorian.TimerUtils.j"
    //! import "(...)\vjassimport\libs\thw.Sevion.Alloc.j"
     

    This is work in progress (expect bugs and crashes) and I need your help with testing it out. Post steps to reproduce when coming across an error.

    Argumentation: <exe call> <input.j (or multiple, separated with space)> <output.j>

    Additional selector examples:
    imports thw.Bribe.Table
    ,
    imports Bannar.ListT
    ,
    imports wc3c.Table


    Note:
    -Libs - folder has to exist. You are free to delete any library from there to force redownload, or you can replace contents of a file yourself
    -Every time that the attempted file is not found, it downloads the resource lists again (as the local ones might be outdated)
    -Every import has to be called with "imports" - first, consequential library names are considered as ordinary requirements
     

    Attached Files:

    Last edited by a moderator: Jul 29, 2016
  2. Version 0.20:
    -Fixed bad behavior that occurred when the output was written to file
    -Library names are now better recognized (still something like Physical Damage Detection can't be picked, because the library's name is DamageEvent)

    I have figured out how you can integrate the tool into JNGP without me changing the tool itself:
    wehack.lua

    Code (Text):

    -- This should replace your old compilemap_path - function in your wehack.lua in JNGP
    function compilemap_path(mappath)
        if mappath == "" then
            showfirstsavewarning()
            return
        end
        map = wehack.openarchive(mappath,15)
        wehack.extractfile(jh_path.."jasshelper\\common.j","scripts\\common.j")
        wehack.extractfile(jh_path.."jasshelper\\Blizzard.j","scripts\\Blizzard.j")
        wehack.extractfile("war3map.j","war3map.j")
        wehack.closearchive(map)
        if cmdargs ~= "" then
            local cmdtable = argsplit(cmdargs)
    grim.log("running tool on save: "..cmdargs)
            wehack.runprocess(cmdargs)
            cmdargs = ""
        end
        -- Here I'll add a new configuration for jasshelper. moyack
        if havejh and jh_enable.checked then
            toolresult = 0
            toolresult = wehack.runprocess("vjassimport\\vjassimport.exe war3map.j out.j")
            if toolresult==0 then
                cmdline = jh_path .. "jasshelper\\jasshelper.exe"
                if jh_debug.checked then
                    cmdline = cmdline .. " --debug"
                end
                if jh_disable.checked then
                    cmdline = cmdline .. " --nopreprocessor"
                end
                if jh_disableopt.checked then
                    cmdline = cmdline .. " --nooptimize"
                end
                -- cmdline = cmdline .. " "..jh_path.."jasshelper\\common.j "..jh_path.."jasshelper\\blizzard.j \"" .. mappath .."\""
                   cmdline = cmdline .. " "..jh_path.."jasshelper\\common.j "..jh_path.."jasshelper\\blizzard.j ".."out.j \"".. mappath .."\""
                toolresult = 0
                toolresult = wehack.runprocess2(cmdline)
                if toolresult == 0 then
                    mapvalid = true
                else
                    mapvalid = false
                end
            else
               mapvalid = false
            end
        end
    end

    So this works if you extract the .rar to your jngp - folder and have JassHelper enabled. The downside is that your don't know what it is doing unless an error is given or it successfully closes.

    Also, am I not an artist :p
    Pure art
    congrats.jpg

    This will be used when I make it auto inject itself into JNGP. This is the message given upon successful inject.