Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Author Topic: Custom TESH Highlighting  (Read 7890 times)

  • Awesome Global Code Moderator
  • Recognized User
  • Rookie - level 2
  • *
  • Posts: 84
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 516
  • vJass Incarnate
    • View Profile
Custom TESH Highlighting
« on: April 14, 2012, 11:43:56 AM »
Custom TESH Highlighting

Table of Contents
  • Introduction
  • Step 1: The Declaration File
  • Step 2: Implementation
  • Wrap-Up
  • FAQ

Introduction

In this tutorial, I'm going to teach you how to get custom TESH highlighting.
This is common knowledge for a lot of people, but not for everyone.
It's actually quite simple, so I don't think anyone should have trouble with it.
What I mean by custom highlighting is highlighting for certain functions.

This can be useful for very common libraries like TimerUtils or UnitIndexer.
I even used it to provide me with highlighting for the hashtable natives.

Step 1: The Declaration File

The first thing we have to do is declare the functions that we want to highlight for TESH to highlight them. What we're going to do is open up Notepad.exe or anything other simple Text-Editor to get started.

I'm going to assume that we want highlighting for TimerUtils by Vexorian.
These are the following functions we want highlighting for:
Code: jass  [Select]
  1. function NewTimer takes nothing returns timer
  2. function NewTimerEx takes integer data returns timer
  3. function ReleaseTimer takes timer t returns nothing
  4. function GetTimerData takes timer t returns integer
  5. function SetTimerData takes timer t, integer data returns nothing

As you can see, those functions don't highlight, and it's pretty annoying, especially considering the fact that a lot of us use them all the time.

Now, you're probably asking yourself: "What am I going to have to include in that file?
Come on Magtheridon96, get to the point already!"

Well, all you have to include is function declarations. You don't need to include any code at all, just the function declaration with the name, the arguments and the return-type.

For TimerUtils by Vexorian, it's going to look like this:
Code: jass  [Select]
  1. // Putting comments here is fine.
  2. // These comments don't show up in the TESH function definitions
  3. // though. You can put content for self-reference inside the function
  4. // definitions in this file though. It's quite handy. Sometimes, you
  5. // might forget what a function does, what form of arguments it
  6. // should take, and a simple type-list isn't going to help. That's
  7. // where these comments become quite useful.
  8.  
  9. function NewTimer takes nothing returns timer
  10.     // Retrieves a new timer from the recycling stack.
  11. endfunction
  12.  
  13. function NewTimerEx takes integer data returns timer
  14.     // Retrieves a new timer from the recycling stack and sets it's data.
  15. endfunction
  16.  
  17. function ReleaseTimer takes timer t returns nothing
  18.     // Throws a timer into the recycling stack.
  19. endfunction
  20.  
  21. function SetTimerData takes timer t, integer data returns nothing
  22.     // Attaches data to a timer.
  23. endfunction
  24.  
  25. function GetTimerData takes timer t returns integer
  26.     // Gets the data attached to a timer.
  27. endfunction
  28.  
  29. // The same can be said about for this comment as well.
  30. // This won't get into the function definitions module.
  31. // If you would go down a bit, I explain a bit about this
  32. // function definition module in the "Tip" below.

Tip: Some people prefer to add comments within the functions.
When you're done with this tutorial, these function declarations and whatever code is in them will be available and can be referenced while you're in the editor simply by holding Ctrl (or Command for Mac Users), and clicking on the function. The comments can be useful for complex functions. They can act as a reminder to you about how a certain function is supposed to take arguments or what it does.

Now that we're done with our declaration file, we're going to save it in the .j format.
If you're using Notepad, all you have to do is Select "File > Save As", then, where it says "Text Document (.txt)", you would change it to "All Files". Now save the file with the extension .j at the end of the name.

Congratulations, you now have a TESH function declaration file!

Step 2: Implementation

We aren't done yet, we still haven't implemented our file.
This step is very easy and straightforward.

  • Open up the JNGP folder.
  • Open the folder named "tesh".
  • Open the folder named "includes".

Now move the function declaration file into the "includes" folder.

Congratulations, you're done!

Wrap-Up

I hope you liked this tutorial. I'm aware that a lot of this is common knowledge.
Still, I believe that this requires a tutorial. If you're having problems, refer to the below FAQ Section:

FAQ

Questions
  • Why doesn't the highlighting show up at all?
  • My file isn't saving as .j! What should I do?
  • I tried copying the Hashtable natives from common.j, but when I paste them and save the file, the text wraps in some very obscure way.
  • Why doesn't the highlighting show up for custom natives?
  • Why can't I add struct methods?

Answers
  • If you were doing the above steps with JNGP running, it isn't going to work.
    All you need to do is restart JNGP and the highlighting should work fine. If you're still having problems, then you either saved the .j file in the wrong directory, or you saved it as a .txt file or something. This only works for .j files.
  • Well, an obscure solution would be to find to open up the JNGP folder, go to the "jasshelper" subfolder, make a copy of common.j, rename it, and change the text.
  • Yeah, some people might face this problem. In the attachments, I've placed a Ready-To-Go Hashtable native declaration file. All you need to do is follow Step 2.
  • You can't declare them as natives. Declare them as functions. That won't tamper with anything, the highlighting has no effect on the Jass Parser.
  • Because SFilip made it a limitation. You can't add struct methods unfortunately.

Side-Note: I hope you like this tutorial.
« Last Edit: April 14, 2012, 02:17:46 PM by moyack »

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 977
  • WC3 Models: 59
  • WC3 Tutorials: 13
  • WC3 Tools: 10
  • WC3 Maps: 12
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 6
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Re: Custom TESH Highlighting
« Reply #1 on: April 14, 2012, 12:32:40 PM »
Fixed. There was a "{list}{list}" code in the post.
« Last Edit: April 14, 2012, 12:57:19 PM by moyack »

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

  • Awesome Global Code Moderator
  • Recognized User
  • Rookie - level 2
  • *
  • Posts: 84
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 516
  • vJass Incarnate
    • View Profile
Re: Custom TESH Highlighting
« Reply #2 on: April 14, 2012, 12:39:27 PM »
Thanks bro :D
I found another forum bug while pasting this :P
edit
Bah, the tags are buggy :c
Basically, if I use the center tag after any of the tags instead of before, it wouldn't wrap correctly :/

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 977
  • WC3 Models: 59
  • WC3 Tutorials: 13
  • WC3 Tools: 10
  • WC3 Maps: 12
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 6
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Re: Re: Custom TESH Highlighting
« Reply #3 on: April 14, 2012, 09:05:27 PM »
Thanks bro :D
I found another forum bug while pasting this :P
edit
Bah, the tags are buggy :c
Basically, if I use the center tag after any of the tags instead of before, it wouldn't wrap correctly :/
Hmmm, it seems like you have a tag misplaced.... but I think I've fixed it...

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

 

Patch 1.28.1, now live and fixing a dangerous thing for custom maps

Started by moyackBoard Warcraft III News

Replies: 0
Views: 521
Last post April 27, 2017, 08:50:54 PM
by moyack
My custom made spell damage function

Started by rvonsonsnadtzBoard Coding Help

Replies: 10
Views: 17065
Last post October 13, 2012, 06:20:48 AM
by rvonsonsnadtz
Custom Ability Source Cost v1.1

Started by radamantusBoard Warcraft III Spells and Systems

Replies: 3
Views: 7632
Last post August 16, 2015, 10:01:55 PM
by moyack
What people want in a Custom XP System?

Started by Naoto ShiroganeBoard Triggers & Scripting

Replies: 3
Views: 4168
Last post April 02, 2015, 06:36:41 PM
by moyack
How to import custom UI

Started by SonofJayBoard Tutorial Zone

Replies: 3
Views: 8531
Last post September 22, 2013, 06:31:25 AM
by moyack
Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!