(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 03-21-2008, 11:39 PM   #31 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Ok

But what of the connecting pre-defined integers to handles (a tiemr in my case)??
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 09-21-2008, 02:53 PM   #32 (permalink)
 
Lord_BoNes's Avatar

Gamer
 
Join Date: Sep 2007
Posts: 147

Lord_BoNes has little to show at this moment (14)Lord_BoNes has little to show at this moment (14)


Idea ???

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
endfunction
function H2S takes handle h returns string
    return I2S(H2I(h))
endfunction

function InitLocalVars takes nothing returns nothing
    if (udg_Cache_LocalVars == null) then
set udg_Cache_LocalVars = InitGameCache("local_vars.w3v")
    endif
endfunction

// ** Integer **
function SetHandleVarInt takes string subject, string name, integer value returns nothing
    call StoreInteger(udg_Cache_LocalVars, subject, name, value)
endfunction
function 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)
endfunction
function 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)
endfunction
function 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)
endfunction
function 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 null
endfunction
function GetHandleVarEffect takes string subject, string name returns effect
    return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarTrigger takes string subject, string name returns trigger
    return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarRect takes string subject, string name returns rect
    return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarRegion takes string subject, string name returns region
    return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarWeatherFX takes string subject, string name returns weathereffect
    return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarTimer takes string subject, string name returns timer
return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarTimerDialog takes string subject, string name returns timerdialog
return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction
function GetHandleVarGroup takes string subject, string name returns group
return GetStoredInteger(udg_Cache_LocalVars, subject, name)
    return null
endfunction

function I2UNIT takes integer i returns unit
    return i
    return null
endfunction
function I2TIMER takes integer i returns timer
    return i
    return null
endfunction
function I2TIMER_DIALOG takes integer i returns timerdialog
    return i
    return null
endfunction
function I2EFFECT takes integer i returns effect
    return i
    return null
endfunction
function I2TRIGGER takes integer i returns trigger
    return i
    return null
endfunction
function I2RECT takes integer i returns rect
    return i
    return null
endfunction
function I2REGION takes integer i returns region
return i
    return null
endfunction
function I2WEATHER_FX takes integer i returns weathereffect
return i
    return null
endfunction
function I2GROUP takes integer i returns group
    return i
    return null
endfunction

function FlushHandleVars takes string subject returns nothing
call FlushStoredMission(udg_Cache_LocalVars, subject)
endfunction

function FlushHandleVarReal takes string subject, string name returns nothing
    call FlushStoredReal(udg_Cache_LocalVars, subject, name)
endfunction
function FlushHandleVarInt takes string subject, string name returns nothing
    call FlushStoredInteger(udg_Cache_LocalVars, subject, name)
endfunction
function FlushHandleVarString takes string subject, string name returns nothing
    call FlushStoredString(udg_Cache_LocalVars, subject, name)
endfunction
function 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
Lord_BoNes is offline   Reply With Quote
Old 09-21-2008, 03:03 PM   #33 (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 

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.
PurplePoot is offline   Reply With Quote
Old 09-21-2008, 08:25 PM   #34 (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)


Didn't the original creator make the jass.sourceforge website (whatever its called) or something?

-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 09-21-2008, 08:33 PM   #35 (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 

KaTTaNa? he wrote the LHV, but not H2I.
PurplePoot is offline   Reply With Quote
Old 09-22-2008, 06:45 AM   #36 (permalink)
 
Lord_BoNes's Avatar

Gamer
 
Join Date: Sep 2007
Posts: 147

Lord_BoNes has little to show at this moment (14)Lord_BoNes has little to show at this moment (14)


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
Lord_BoNes is offline   Reply With Quote
Old 09-22-2008, 04:43 PM   #37 (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)


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.
Captain Griffen is offline   Reply With Quote
Old 09-23-2008, 12:59 AM   #38 (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 

I suggest you look into struct attachment methods, such as this.
PurplePoot is offline   Reply With Quote
Old 11-19-2008, 01:26 PM   #39 (permalink)
 
vercas's Avatar

The almighty Lich...
 
Join Date: Dec 2007
Posts: 1,185

vercas has little to show at this moment (56)


Quote:
Originally Posted by Ralle View Post
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!
__________________
My dragons!

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

(\__/)
(='.'=)
Spread the Emoticat!
WWWWWWWWWWWWWWWWWWWW
vercas 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 08:06 AM.






Your link here 
Credit Score | MPAA | Hsbc | Proxy | News
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle