 |   |  |  |
JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum. |
 |
|
03-21-2008, 11:39 PM
|
#31 (permalink)
|
Me in a few words???
Join Date: Aug 2007
Posts: 949
|
Ok
But what of the connecting pre-defined integers to handles (a tiemr in my case)??
__________________
77% of all people are neurotic
|
|
|
09-21-2008, 02:53 PM
|
#32 (permalink)
|
Gamer
Join Date: Sep 2007
Posts: 147
|
???
I'm not sure of this, but I think that the author of H2I was KaTaNa. That was the first person, that I know of, to use it. Especially to attach vars to handles.
I'm in the process of making a DotA'ish map of my own (from scratch). It uses a fair amount of triggered abilities and for speed's sake I use these functions:
//**************************************// Local Handle Variables//**************************************function H2I takes handle h returns integer return h return 0 endfunctionfunction H2S takes handle h returns string return I2S (H2I (h ))endfunctionfunction InitLocalVars takes nothing returns nothing if (udg_Cache_LocalVars == null) then set udg_Cache_LocalVars = InitGameCache ("local_vars.w3v") endifendfunction// ** Integer **function SetHandleVarInt takes string subject, string name, integer value returns nothing call StoreInteger (udg_Cache_LocalVars, subject, name, value )endfunctionfunction GetHandleVarInt takes string subject, string name returns integer return GetStoredInteger (udg_Cache_LocalVars, subject, name )endfunction// ** Float **function SetHandleVarReal takes string subject, string name, real value returns nothing call StoreReal (udg_Cache_LocalVars, subject, name, value )endfunctionfunction GetHandleVarReal takes string subject, string name returns real return GetStoredReal (udg_Cache_LocalVars, subject, name )endfunction// ** String **function SetHandleVarString takes string subject, string name, string value returns nothing call StoreString (udg_Cache_LocalVars, subject, name, value )endfunctionfunction GetHandleVarString takes string subject, string name returns string return GetStoredString (udg_Cache_LocalVars, subject, name )endfunction// ** Boolean **function SetHandleVarBoolean takes string subject, string name, boolean value returns nothing call StoreBoolean (udg_Cache_LocalVars, subject, name, value )endfunctionfunction GetHandleVarBoolean takes string subject, string name returns boolean return GetStoredBoolean (udg_Cache_LocalVars, subject, name )endfunction//-------------------// CONVERSIONS//-------------------function GetHandleVarUnit takes string subject, string name returns unit return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarEffect takes string subject, string name returns effect return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarTrigger takes string subject, string name returns trigger return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarRect takes string subject, string name returns rect return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarRegion takes string subject, string name returns region return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarWeatherFX takes string subject, string name returns weathereffect return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarTimer takes string subject, string name returns timer return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarTimerDialog takes string subject, string name returns timerdialog return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction GetHandleVarGroup takes string subject, string name returns group return GetStoredInteger (udg_Cache_LocalVars, subject, name ) return nullendfunctionfunction I2UNIT takes integer i returns unit return i return nullendfunctionfunction I2TIMER takes integer i returns timer return i return nullendfunctionfunction I2TIMER_DIALOG takes integer i returns timerdialog return i return nullendfunctionfunction I2EFFECT takes integer i returns effect return i return nullendfunctionfunction I2TRIGGER takes integer i returns trigger return i return nullendfunctionfunction I2RECT takes integer i returns rect return i return nullendfunctionfunction I2REGION takes integer i returns region return i return nullendfunctionfunction I2WEATHER_FX takes integer i returns weathereffect return i return nullendfunctionfunction I2GROUP takes integer i returns group return i return nullendfunctionfunction FlushHandleVars takes string subject returns nothing call FlushStoredMission (udg_Cache_LocalVars, subject )endfunctionfunction FlushHandleVarReal takes string subject, string name returns nothing call FlushStoredReal (udg_Cache_LocalVars, subject, name )endfunctionfunction FlushHandleVarInt takes string subject, string name returns nothing call FlushStoredInteger (udg_Cache_LocalVars, subject, name )endfunctionfunction FlushHandleVarString takes string subject, string name returns nothing call FlushStoredString (udg_Cache_LocalVars, subject, name )endfunctionfunction FlushHandleVarBoolean takes string subject, string name returns nothing call FlushStoredBoolean (udg_Cache_LocalVars, subject, name )endfunction
To attach or read an attached var I use:
local string hand = H2I([i]unit[/i]) local integer var = GetHandleVarInt(hand, "name")
<Insert other code here>
set hand = null
Doing the H2I only once per handle is alot faster than doing it per variable.
__________________
- BoNes
"To kill one is a tragedy, to kill 10,000,000 is a statistic"
-Joseph Stalin
|
|
|
09-21-2008, 03:03 PM
|
#33 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
That's the idea behind vex's tables. Either way, attaching handles by gamecache is so horribly out of date that I suggest you avoid it at all costs. It's buggy and slow.
Also, KaTTaNa was not the author of H2I. If I recall correctly, the original author was called Super(something), perhaps SuperLKL or such.
|
|
|
09-21-2008, 08:25 PM
|
#34 (permalink)
|
Mursumane Strike!
Join Date: Jul 2005
Posts: 290
|
Didn't the original creator make the jass.sourceforge website (whatever its called) or something?
-Av3n
__________________
Thanks to FatherTime for the sig
|
|
|
09-21-2008, 08:33 PM
|
#35 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
KaTTaNa? he wrote the LHV, but not H2I.
|
|
|
09-22-2008, 06:45 AM
|
#36 (permalink)
|
Gamer
Join Date: Sep 2007
Posts: 147
|
What would you suggest instead of H2I?
@PurplePoot:
I'm after the fastest MOST efficient way of doing things. I've found that my way IS faster than the way that KaTTaNa originally wrote. But, if you can suggest a much better way of doing it, I'd be extremely greatful.
Just a question here: how is the gamecache way "buggy"?
Thanx.
__________________
- BoNes
"To kill one is a tragedy, to kill 10,000,000 is a statistic"
-Joseph Stalin
|
|
|
09-22-2008, 04:43 PM
|
#37 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
Ha. Most efficient way is not to touch GC (normally, some uses it is nice...not here).
GC isn't buggy, but LHV are, when attaching handles, as they use a I2H typecast, which is unsafe.
H2I's origins are unknown...weaaader or one of a few others around the same time were the first to use it.
__________________
 | 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. | |
|
|
|
09-23-2008, 12:59 AM
|
#38 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
I suggest you look into struct attachment methods, such as this.
|
|
|
11-19-2008, 01:26 PM
|
#39 (permalink)
|
The almighty Lich...
Join Date: Dec 2007
Posts: 1,185
|
Quote:
Originally Posted by Ralle
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.
|
Ok Ralle, this surprised me! 
And i undestand this :D
Very useful!
I don't think i am going to use it, but this helps many people!
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|  |  |  |  |   |  |
|