- Nov 14, 2008
This is just a simple tutorial how to add your own functions so they get highlighted by TESH
Yet I have to tell you this right here and now that this tutorial contains some materials from a site which I can't mention because it isn't allowed. Most coders know this site especially Russians (I think you know where I am going right now). So I will just upload the files needed into a ZIP and I give full credit to the authors which I can't mention due to what was said above. If I can get this approval by an admin to upload these files as they are very useful I would be glad, else I will just delete the "update" part of this tutorial.
I have spoken with TriggerHappy about this and he said no, so I removed the other part.
JASS NewGen Pack installed. Link
Common sense of browsing in your computer.
How to open 7z files.
Make your own highlight functions for TESH
As you might have seen there is a "included" folder inside the TESH folder. This folder is used for if you want to make custom highlight for your functions.
First you'll open JNGP and convert a new trigger into custom text or you do this in a normal text editor like word/notepad or just within a THW JASS tag like I will do.
You have to decide what functions you will use, I will use the API of GroupUtils, TimerUtils and SimError, very common libraries.
We look up there functions and rewrite them in our JASStag or editor like this:
//GroupUtils function NewGroup takes nothing returns group //example //local group g = NewGroup() endfunction function ReleaseGroup takes group g returns boolean //example //call ReleaseGroup(g) endfunction function GroupRefresh takes group g returns nothing //example //call GroupRefresh(g) endfunction function GroupEnumUnitsInArea takes group whichgroup, real x, real y, real radius, boolexpr filter returns nothing //example //call GroupEnumUnitsInArea(g, 0., 0., 300., null) endfunction function GroupUnitsInArea takes group whichgroup, real x, real y, radius returns nothing //example //call GroupUnitsInArea(g, 0., 0., 300.) endfunction //TimerUtils function NewTimer takes nothing returns timer //Get a timer (alternative to CreateTimer) //example //set t = NewTimer() endfunction function ReleaseTimer takes timer t returns nothing //example //call ReleaseTimer(t) endfunction function SetTimerData takes timer t, integer value returns nothing //example //call SetTimerData(t, 2) endfunction function GetTimerData takes timer t returns integer //Get the timer's value. //You can assume a timer's value is 0 after NewTimer. //example //GetTimerData(GetExpiredTimer()) endfunction //Sim Error function SimError takes player ForPlayer, string msg returns nothing //ForPlayer : The player to show the error //msg : The error msg endfunction
Copy this into a text editor file and change the name of the file to "CommonFunctions.j". This will give you an error that you might screw this up when you change the format, ignore this, it wont.
Remember when you add your custom highlights, the text files have to be converted into .j files else it won't work!
Save the file and move it into the "include" folder inside the Tesh folder.
Open up JNGP and open the function list and there it is!
And this is how it will look like when you code!
Also it will show your arguments!
Now you're done!
Some known issues which I can't solve.
-Adding your own natives into TESH (like with RTC), you can't highlight these as inserting it as a normal native in the function list, it wont show.
native Yournative takes arguments returns stuff, wont show
Solution to that is to make your "custom native" a function which takes the same as the native.
function Yournative takes arguments returns stuff
-I suppose this only works with .j files, if anyone know more please just reply.
Last edited by a moderator: