(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Resources > JASS Functions

JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum.

Reply
 
LinkBack Thread Tools Display Modes
Old 06-07-2007, 03:39 PM   #1 (permalink)
 
Diablo-dk's Avatar

Shifting voidwalker!
 
Join Date: Nov 2004
Posts: 396

Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)


Typecasting - Handle to integer


function H2I takes handle h returns integer
    return h
    return 0
endfunction
The well known H2I function which is very usefull.
stores a handle's address in an integer, allowing various storing systems.


Return bug information by weaaddar:
Quote:
weaaddar:
All variable types in warcraft 3 are four bytes in length. The atomic types (ints, reals, and booleans) use thier four bytes as direct value. Handles use thier four bytes of space as a "pointer" to thier object they references "memory address". I use the terms "pointer" loosely. As they are not first class pointers. As well as "memory address", it is believed all objects are stored in a specific heap and these are thier keys to them. But that is irrelavant.
Anyway, the Jass parser only checks the last return value satiates the return type. Thus we "trick" it into taking a handle when it really was meant to take an integer.
Converting the integer address of the handle back to a handle is done using functions like this:
function I2U takes integer i returns unit
    return i
    return null
endfunction
function I2Trigger takes integer i returns trigger
    return i
    return null
endfunction
function I2Timer takes integer i returns timer
    return i
    return null
endfunction
Ex: if you converted a unit to an integer you will have to use I2U(ConvertedUnit) to retain the unit. For a trigger you would have to use I2Trigger(ConvertedTrigger)

NOTE: Do not use this on handles like

lightning, ubersplat, texttag, damagetype, attacktype, weapontype and playerstate
as some of them have similar ids.

Thanks to SuperIKI and Peppar for discovering this function.
__________________
Need an easy Recipe System for your map?
Wonder what is inside the Spellbook?
Check my Cinematic!

Vote for the hive, the most friendly wc3 website.

Last edited by Diablo-dk; 07-15-2007 at 09:48 PM..
Diablo-dk is offline   Reply With Quote
Old 06-07-2007, 03:47 PM   #2 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


Quote:
Only submit your own resources unless permission quoted/stated.
This isn't your own.
__________________
Quote:
[20-00-13] MasterHaosis: Because I am retarded douchebag
[20-15-23] MasterHaosis: I am faggot, retard and such..
[20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me
~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out.
Captain Griffen is offline   Reply With Quote
Old 06-07-2007, 03:53 PM   #3 (permalink)
 
Diablo-dk's Avatar

Shifting voidwalker!
 
Join Date: Nov 2004
Posts: 396

Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)


Then who made it? It is used by alot of people and i don't really know if anyone knows who's the author real author.

I felt that people new to jass would have to know about this function as it is used alot and is very important.
__________________
Need an easy Recipe System for your map?
Wonder what is inside the Spellbook?
Check my Cinematic!

Vote for the hive, the most friendly wc3 website.
Diablo-dk is offline   Reply With Quote
Old 06-07-2007, 04:18 PM   #4 (permalink)
Owner
 
Ralle's Avatar

WoW! StarCraft II
 
Join Date: Oct 2004
Posts: 6,116

Ralle has disabled reputation (1523)Ralle has disabled reputation (1523)Ralle has disabled reputation (1523)Ralle has disabled reputation (1523)


well if this is "authorless" material. I'd say it is OK.
BTW. I am new to JASS and I don't understand at all what this could be used for.
__________________
Info:
Ralle'sSigna-ture
Todo ListPM MeNews
Progress:
New Section
||||||||||
Ralle is offline   Reply With Quote
Old 06-07-2007, 04:34 PM   #5 (permalink)
 
Diablo-dk's Avatar

Shifting voidwalker!
 
Join Date: Nov 2004
Posts: 396

Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)


I'm not sure if it's authorless, but i haven't heard anything about who made it.

It can be used to transfer a handle through some storing method and much other stuff.

Check out Local Handle Vars, you will see alot of use in it.
__________________
Need an easy Recipe System for your map?
Wonder what is inside the Spellbook?
Check my Cinematic!

Vote for the hive, the most friendly wc3 website.
Diablo-dk is offline   Reply With Quote
Old 06-07-2007, 07:44 PM   #6 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


It had an author. I wasn't involved in JASS work back then, but I bet one of the older JASSers would be likely to know.
__________________
Quote:
[20-00-13] MasterHaosis: Because I am retarded douchebag
[20-15-23] MasterHaosis: I am faggot, retard and such..
[20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me
~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out.
Captain Griffen is offline   Reply With Quote
Old 06-09-2007, 04:47 PM   #7 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

Ralle;

It's used for storing data to stuff through a gamecache, since each handle has a different ID, each gamecache slot will be different, allowing for you to store data under the same name to several different objects (usually timers) without overlap.

It can also be use for debugging, storing to custom values, etc, etc.
PurplePoot is offline   Reply With Quote
Old 06-09-2007, 09:53 PM   #8 (permalink)
Spell and Map Moderator
 
Dr Super Good's Avatar

The Helpful Personage
 
Join Date: Jan 2005
Posts: 4,261

Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)


Vexorian is most lightly to know who made it but anyway, approve this for now since it is the most usefull function made that I know of.

Fix the typo in the name as well since it is "H2I" and not "H2i"
Dr Super Good is offline   Reply With Quote
Old 06-09-2007, 09:57 PM   #9 (permalink)
 
Diablo-dk's Avatar

Shifting voidwalker!
 
Join Date: Nov 2004
Posts: 396

Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)Diablo-dk has a spectacular aura about (129)


I did call it H2I, but for some reason it changed automatically to H2i(this also happened when i tryed to preview the thread before posting)
It would be nice if some mod could rename it to H2I.
__________________
Need an easy Recipe System for your map?
Wonder what is inside the Spellbook?
Check my Cinematic!

Vote for the hive, the most friendly wc3 website.
Diablo-dk is offline   Reply With Quote
Old 06-09-2007, 10:47 PM   #10 (permalink)
Spell and Map Moderator
 
Dr Super Good's Avatar

The Helpful Personage
 
Join Date: Jan 2005
Posts: 4,261

Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)


Only a section moderator can fix it now so it was not really aimed at you. . .
Dr Super Good is offline   Reply With Quote
Old 06-09-2007, 11:03 PM   #11 (permalink)
 
Av3n's Avatar

Mursumane Strike!
 
Join Date: Jul 2005
Posts: 290

Av3n has little to show at this moment (31)Av3n has little to show at this moment (31)Av3n has little to show at this moment (31)Av3n has little to show at this moment (31)


It would be nice if you list every handle it doesn't work on

-Av3n
__________________
The corruption of two factions, leads to the ultimate battle in Power of Corruption.


Thanks to FatherTime for the sig
Av3n is offline   Reply With Quote
Old 06-09-2007, 11:47 PM   #12 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


It is H2I or h2i. Both are used. There was an attempt I believe to move to a standard of lower case for type casting functions, to differentiate more with functions like I2S, etc.

I'd say any 'author-less' resources are only placed by a staff member, with clear indication in the title it is not their work. I'd also recommend that if you put this one in, it gets stickied due to overall importance.
__________________
Quote:
[20-00-13] MasterHaosis: Because I am retarded douchebag
[20-15-23] MasterHaosis: I am faggot, retard and such..
[20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me
~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out.
Captain Griffen is offline   Reply With Quote
Old 06-11-2007, 10:02 PM   #13 (permalink)

Awesome Inside
 
Join Date: Nov 2003
Posts: 166

PitzerMike will become famous soon enough (115)PitzerMike will become famous soon enough (115)PitzerMike will become famous soon enough (115)

Respected User: This user has been given the respected user award. 

The first JASSer to exploit H2I was SuperIKI followed by Peppar.
PitzerMike is offline   Reply With Quote
Old 06-11-2007, 10:11 PM   #14 (permalink)
 
ragingspeedhorn's Avatar

Unpopular since 2005!
 
Join Date: Apr 2005
Posts: 6,409

ragingspeedhorn is a name known to all (748)ragingspeedhorn is a name known to all (748)ragingspeedhorn is a name known to all (748)ragingspeedhorn is a name known to all (748)ragingspeedhorn is a name known to all (748)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Paired Mapping Contest #3 Winner: Warcraft Arena Paired Mapping Contest #2 Winner: Hell Scream's Party Cinematic Mini-Contest #1 Winner: The Escape & The Premonition 

Quote:
Originally Posted by PitzerMike View Post
The first JASSer to exploit H2I was SuperIKI followed by Peppar.
Peppar as in Peppars Multiplayer Chess? Cool guy, didn't know he actually participated in the modding scene, I just thought he made his map and that was it.
ragingspeedhorn is offline   Reply With Quote
Old 06-12-2007, 06:12 AM   #15 (permalink)

Awesome Inside
 
Join Date: Nov 2003
Posts: 166

PitzerMike will become famous soon enough (115)PitzerMike will become famous soon enough (115)PitzerMike will become famous soon enough (115)

Respected User: This user has been given the respected user award. 

Yes, that Peppar.
Just check wc3jass.com, he has submitted some nice scripts back then, also used to post at wc3c when there was the good old AI/Jass forum.
PitzerMike is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Handle Var Marcelo Hossomi World Editor Help Zone 9 05-15-2007 11:49 PM
moderators who handle how they like to do it? dhk_undead_lord Off-Topic 16 01-13-2007 12:23 PM
[JASS] get/store integer with integer index per unit Lord Raszul Requests 0 12-17-2005 06:47 PM
[JASS] Item Handle Dr.Nitro Triggers & Scripts 2 12-03-2005 12:52 AM
[JASS] explain handle? wikidme Triggers & Scripts 4 09-29-2004 06:24 PM

All times are GMT. The time now is 07:42 AM.