• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[WIP] Automatic dependency importer in vJASS

What would you like me to focus on?

  • Add support for TheHelper.net

    Votes: 0 0.0%
  • Fix bad behavior (please post comment)

    Votes: 0 0.0%
  • JNGP Integration

    Votes: 0 0.0%
  • //! fetch - preprocessor command (same as imports)

    Votes: 0 0.0%
  • This tool doesn't need anything else (casual bug fixing)

    Votes: 0 0.0%

  • Total voters
    0
Status
Not open for further replies.

Deleted member 219079

D

Deleted member 219079


JASS:
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:
JASS:
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
 

Attachments

  • vjassimport-0.20.rar
    17.1 KB · Views: 68
Last edited by a moderator:

Deleted member 219079

D

Deleted member 219079

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:

Code:
-- 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
congrats.jpg

This will be used when I make it auto inject itself into JNGP. This is the message given upon successful inject.
 
Status
Not open for further replies.
Top