[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > WarCraft III Tutorials > Miscellaneous Tutorials


Miscellaneous Tutorials Warcraft III tutorials that do not fit into any other category.
Read the Rules before posting.

Closed Thread
 
Thread Tools
Old 04-14-2012, 05:58 AM   #1 (permalink)
Forum Moderator Magtheridon96
Go away.
 
Magtheridon96's Avatar
Resource Moderator
 
Join Date: Dec 2008
Posts: 5,754
Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. 
Custom TESH Highlighting

JassNewGenPack Tutorial:
Custom TESH Highlighting


Table of Contents
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:
function NewTimer takes nothing returns timer
function NewTimerEx takes integer data returns timer
function ReleaseTimer takes timer t returns nothing
function GetTimerData takes timer t returns integer
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:
Jass:
// Putting comments here is fine.
// These comments don't show up in the TESH function definitions
// though. You can put content for self-reference inside the function
// definitions in this file though. It's quite handy. Sometimes, you
// might forget what a function does, what form of arguments it
// should take, and a simple type-list isn't going to help. That's
// where these comments become quite useful.

function NewTimer takes nothing returns timer
    // Retrieves a new timer from the recycling stack.
endfunction

function NewTimerEx takes integer data returns timer
    // Retrieves a new timer from the recycling stack and sets it's data.
endfunction

function ReleaseTimer takes timer t returns nothing
    // Throws a timer into the recycling stack.
endfunction

function SetTimerData takes timer t, integer data returns nothing
    // Attaches data to a timer.
endfunction

function GetTimerData takes timer t returns integer
    // Gets the data attached to a timer.
endfunction

// The same can be said about for this comment as well.
// This won't get into the function definitions module.
// If you would go down a bit, I explain a bit about this
// function definition module in the "Tip" below.

// The comment you are currently reading was only put here
// to hide the ugliness of a blank fragment in a Jass tag. :P

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
  1. Why doesn't the highlighting show up at all?
  2. My file isn't saving as .j! What should I do?
  3. 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.
  4. Why doesn't the highlighting show up for custom natives?
  5. Why can't I add struct methods?

Answers
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Because SFilip made it a limitation. You can't add struct methods unfortunately.
Attached Files
File Type: j HashtableNatives.j (12.1 KB, 59 views)

Last edited by Magtheridon96; 04-14-2012 at 01:46 PM.
Magtheridon96 is offline  
Old 04-14-2012, 01:25 PM   #2 (permalink)
Registered User Adiktuz
BusyWithSchool
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 8,615
Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)
nice tutorial man... really helpful...

btw, how do you add struct methods? I can't seem to make them work...
Adiktuz is online now  
Old 04-14-2012, 01:45 PM   #3 (permalink)
Forum Moderator Magtheridon96
Go away.
 
Magtheridon96's Avatar
Resource Moderator
 
Join Date: Dec 2008
Posts: 5,754
Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. 
Oh yeah, I forgot to mention that struct methods can't be added :P
Even something like
Jass:
function DamageEvent.ANY.register takes boolexpr c returns nothing

endfunction
doesn't work.

I guess SFilip made it a limitation :/
__________________
Magtheridon96 is offline  
Old 04-14-2012, 03:14 PM   #5 (permalink)
Registered User mckill2009
SSJ99999 Pinoy!
 
mckill2009's Avatar
 
Join Date: Mar 2009
Posts: 4,474
mckill2009 is a splendid one to behold (872)mckill2009 is a splendid one to behold (872)mckill2009 is a splendid one to behold (872)mckill2009 is a splendid one to behold (872)mckill2009 is a splendid one to behold (872)mckill2009 is a splendid one to behold (872)
very nice and simple but very useful!
__________________
My Resources:
My Maps
My Systems/Spells

Your ideas tend to result in unnecessary violence so shut the F*** up!
mckill2009 is offline  
Old 04-14-2012, 04:37 PM   #6 (permalink)
Registered User moyackx
"I rise. You fall."
 
moyackx's Avatar
 
Join Date: Feb 2006
Posts: 552
moyackx is just really nice (379)moyackx is just really nice (379)moyackx is just really nice (379)moyackx is just really nice (379)
Zephyr Challenge #1 - Winner: Cursed Soul 
Very nice :)

/*cough could you post it in my site too :D */cough
moyackx is online now  
Old 04-14-2012, 05:02 PM   #7 (permalink)
Forum Moderator Magtheridon96
Go away.
 
Magtheridon96's Avatar
Resource Moderator
 
Join Date: Dec 2008
Posts: 5,754
Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. 
Quote:
Very nice :)

/*cough could you post it in my site too :D */cough
Done :P
http://blizzardmodding.info/scriptin...-highlighting/
__________________
Magtheridon96 is offline  
Old 04-14-2012, 06:57 PM   #8 (permalink)
Registered User Troll-Brain
cool != useful
 
Troll-Brain's Avatar
 
Join Date: Apr 2008
Posts: 1,948
Troll-Brain is just really nice (377)Troll-Brain is just really nice (377)Troll-Brain is just really nice (377)Troll-Brain is just really nice (377)
That just proves the fact that many people don't read the documentation of the tools they are using :p

So this kind of tutorial seems necessary :/
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.

You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
Troll-Brain is offline  
Old 04-14-2012, 08:27 PM   #9 (permalink)
Forum Moderator Magtheridon96
Go away.
 
Magtheridon96's Avatar
Resource Moderator
 
Join Date: Dec 2008
Posts: 5,754
Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)Magtheridon96 has a brilliant future (1891)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. 
Well, I don't read the documentation either =P
I knew this information ever since I started working with vJass and using Damage by Jesus4Lyf, which had a TESH file included in the resource thread at thehelper.net :P

Yesterday, I tried it out and started creating custom highlighting for UnitIndexer, TimerUtils, RegisterPlayerUnitEvent, SoundTools, and I even made the Hashtable natives because I was never able to get them to highlight like regular natives :D
__________________
Magtheridon96 is offline  
Old 04-16-2012, 10:05 PM   #10 (permalink)
Forum Moderator PurgeandFire
ʕ•͡ᴥ•ʔ
 
PurgeandFire's Avatar
Resource & Tutorial Moderator
 
Join Date: Nov 2006
Posts: 3,666
PurgeandFire has much of which to be proud (1144)PurgeandFire has much of which to be proud (1144)PurgeandFire has much of which to be proud (1144)PurgeandFire has much of which to be proud (1144)PurgeandFire has much of which to be proud (1144)PurgeandFire has much of which to be proud (1144)PurgeandFire has much of which to be proud (1144)
Great. People have asked this quite a few times in the past, so this is useful and a great linkback. Also, it is a bit more concise compared to the readme file, so approved.
PurgeandFire is online now  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 01:58 AM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle