• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Tool v1.1

  • Tool v1.0
  • "Tool" is a JASS system that allows you to integrate tools into JNGP with a simple JASS code registry and LUA code and MS-DOS code insertion. This system will only be useful before the release of JNGP2 of moyackx.
  • Code:
    JASS:
    //*************************************************************************************
    //*
    //*    Tool by Almia
    //*
    //*************************************************************************************
    //*
    //*    This tool allows you to integrate tools into JNGP. This is a very, very, very
    //*    sensitive system so please use this carefully.
    //*
    //*    This system will only be useful before the release of JNGP2 by moyackx.
    //*
    //*    PLEASE DO NOT IMPORT THIS SYSTEM! USE THE SYSTEM HERE!
    //*
    //*************************************************************************************
    //*
    //*    How to use?
    //*
    //*    THE FOLLOWING STEPS NEEDS TO BE FOLLOWED!
    //*
    //*    - Open the trigger test.
    //*    - Delete the codes used( the codes that has Notepad and CMD words)
    //*    - Don't delete the action call DownloadToolInstaller
    //*    - Above it, use AddTool and put the Tool Path and Tool Name
    //*      ( Example : AddTool("Notepad.exe", "Notepad")
    //*    - Open this system's code.
    //*    - Configure FullPath and JNGP functions(path's must be equal to where JNGP is
    //*      and what is the name of JNGP's folder)
    //*    - If you are using JNGP at this moment:
    //*      -  Save this map
    //*      -  Close JNGP
    //*      -  If "Tool.w3x" is not inside the Warcraft III maps, move it to there.
    //*      -  Run Warcraft III
    //*    - Test Tool.w3x
    //*    - Once the map starts, close it.
    //*    - Go to the JNGP folder and find "ToolInstaller.bat" then run it.
    //*    - Open JNGP and see if it works.
    //*
    //*************************************************************************************
    //*
    //*    Warning : You may only use this system once, if you use it more than once,
    //*              please open wehack.lua and do the following:
    //*                  - Scroll to the very bottom until you reach a giant block of 
    //*                    comment that has the title : "TOOL IMPLEMENTATION SECTION"
    //*                  - Go find again this kind of line and delete the line after it.
    //*                    "extTools = wehack.addmenu("External Tools")
    //*
    //*************************************************************************************
    //*
    //*    API
    //*
    //*    function AddTool takes string toolPath, string toolName returns nothing
    //*        - Add's the tool to the list
    //*
    //*    function DownloadToolInstaller takes nothing returns nothing
    //*        - Downloads the tool installer
    //*
    //*************************************************************************************
    //*
    //*    Credits
    //*
    //*    moyackx
    //*    PurgeandFire
    //*
    //*************************************************************************************
    //*
    //*    Alternative methods
    //*
    //*    You can read this tutorial made by PurgeandFire:
    //*    [ hiveworkshop.com/forums/miscellaneous-tutorials-456/integrating-tools-into-jngp-234157/ ]
    //*
    //*************************************************************************************
    constant function JNGP takes nothing returns string
        return "jassnewgenpack5e\\"
    endfunction
    
    constant function FolderPath takes nothing returns string
        return "C:\\Documents and Settings\\Jetroden03\\My Documents\\Downloads\\" + JNGP()
    endfunction
    
    constant function FilePath takes nothing returns string
        return FolderPath() + "ToolInstaller.bat"
    endfunction
    
    constant function ExtTools takes nothing returns string
        return "extTools"
    endfunction
    
    constant function ExtToolsName takes nothing returns string
        return "External Tools"
    endfunction
    
    function AddTool takes string toolPath, string toolName returns nothing
        local string s = I2S(udg_Tools + 1)
        set udg_Tools = udg_Tools + 1
        set udg_Tool[udg_Tools] = toolName
        set udg_Tool_Func[udg_Tools] = "function tool" + s + "()"
        set udg_Tool_Exec[udg_Tools] = "    wehack.execprocess(\"" + toolPath + "\")"
        set udg_Tool_Entry[udg_Tools]= "tools" + s + " = MenuEntry:New( " + ExtTools() + ",\"" + toolName + "\", tool" + s + " )"
    endfunction
    
    function DownloadToolInstaller takes nothing returns nothing
        local integer i = 0
        call PreloadGenClear()
        call PreloadGenStart()
        call Preload("\")\r\n\techo --------------------------------------------------------------- >> wehack.lua\r\n\t(\"")
        call Preload("\")\r\n\techo ----------------- TOOL IMPLEMENTATION SECTION ----------------- >> wehack.lua\r\n\t(\"")
        call Preload("\")\r\n\techo --------------------------------------------------------------- >> wehack.lua\r\n\t(\"")
        call Preload("\")\r\n\techo " + ExtTools() + " = wehack.addmenu(\"" + ExtToolsName() + "\") >> wehack.lua\r\n\t(\"")
        loop
            exitwhen i == udg_Tools
            set i = i + 1
            call Preload("\")\r\n\techo -- " + udg_Tool[i]     + " >> wehack.lua\r\n\t(\"")
            call Preload("\")\r\n\techo " + udg_Tool_Func[i]  + " >> wehack.lua\r\n\t(\"")
            call Preload("\")\r\n\techo " + udg_Tool_Exec[i]  + " >> wehack.lua\r\n\t(\"")
            call Preload("\")\r\n\techo end                       >> wehack.lua\r\n\t(\"")
            call Preload("\")\r\n\techo " + udg_Tool_Entry[i] + " >> wehack.lua\r\n\t(\"")
            call Preload("\")\r\n\techo -- End of " + udg_Tool[i] + " Implementation >> wehack.lua\r\n\t(\"")
        endloop
        // This is only for my debugging purposes.
        // Leave this line below as a comment.
        // call Preload("\")\r\n\tstart wehack.lua\r\n\t(\"")
        // Leave this line above as a comment.
        call PreloadGenEnd(FilePath())
        call BJDebugMsg("Tool installer succesfully downloaded. Please go to " + FolderPath() + " to install.")
    endfunction
    
    function InitTrig_Tool takes nothing returns nothing
    endfunction
  • Demo:
    • Test
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Custom script: call AddTool("Notepad.exe", "Notepad")
        • Custom script: call AddTool("CMD.exe", "Command Prompt")
        • Custom script: call DownloadToolInstaller()
  • Credits to PurgeandFire and moyackx
  • Changelog
    - Added a "How to fix double-installation" problem solution
    - Removed FullPath
Contents

Tool v1.0 (Map)

Reviews
16:28, 15th Jun 2013 PurgeandFire: Approved. A nice JASS alternative to adding tool shortcuts to JNGP.

Moderator

M

Moderator

16:28, 15th Jun 2013
PurgeandFire: Approved. A nice JASS alternative to adding tool shortcuts to JNGP.
 
I think you can do it with file IO very easy too.

Denied.
File IO creates its own file,which aren't injected to something. But Preloads yes.

I want to ask why you didnt use globals but constant functions when you clearly are making system that only works for JNGP users, so why limit the script for normal editor
JASS. and
l
V

Why is this done in JASS...?
I don't want users to test this in JNGP so I coded it in JASS. If you saw the README steps,you know what I meant.

Well, this script actually inject additional tools to JNGP, adding tools such as notepad etc that isn't naturally available at JNGP.

When reading this tool what is coming to my mind is it possible to make a save code data in notepad, so then we can transfer data between maps [like save load system]

The first statement is correct. The second is too far out XD
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I don't want users to test this in JNGP so I coded it in JASS. If you saw the README steps,you know what I meant.

I wasn't referring to vJass over Jass, im just saying that JASS should only be used for Warcraft 3 and not batch plugins like that
 
Tested and it works. Neat alternative to writing the lua manually. For those of you who are confused about what this does, it is kind of like adding shortcuts to certain programs in your JNGP. For example, I add MDX Squisher, Magos' Model Editor, and BLP Lab all to that menu so that I can access it easily for quick changes (opposed to making a shortcut on my desktop).

However, it kind of sucks that you have to delete the lines manually to remove the tool. I'm aware that there may not be much you can do about it (at least AFAIK, I don't know how extensive the Windows batch language is in terms of file manip.), but you should make it a bit easier. Separate each "tool" implementation with comments. For example:
Code:
-- Notepad
function tool1()
    wehack.execprocess(path)
end
tools1 = MenuEntry:New(...)
-- End Notepad Implementation

And add some instructions on how to delete it. Tell them to open wehack.lua, scroll all the way to the bottom, and delete the section enclosed in comments for that specific tool. That way they won't mess anything up, such as the boolean that says "isStartup = false".

The reason why that is important is that it is easy to make mistakes (as you said yourself, the system is sensitive). If someone types the wrong path or adds a tool twice, they should be able to read the instructions to find out how to delete it. ;) Make those changes and I'll approve.
 
Top