Moderator
M
Moderator
16:28, 15th Jun 2013
PurgeandFire: Approved. A nice JASS alternative to adding tool shortcuts to JNGP.
PurgeandFire: Approved. A nice JASS alternative to adding tool shortcuts to JNGP.
//*************************************************************************************
//*
//* 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
|