Jass Vault WC3Jass.com
"The Jass Vault"
 
 FAQ   Search   Memberlist   Usergroups   Register 
 Profile   Log in to check your private messages   Log in  
 Forum   Scripts   Files   Chat   Pastebin   Function finder  
Affiliates
The HIVE Workshop Games Modding
The Hubb Wc3Campaigns
WC3-Mapping.net

Local Handle Variables
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    Jass Vault -> Standard Functions
View previous script :: View next script  

Script code
// ===========================
function H2I takes handle h returns integer
    return h
    return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
    // Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
    return InitGameCache("jasslocalvars.w3v")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
Script info
Description
Stores and recieves local variables from handles.
Here is a short example:
Code:
// Add spawn to a group stored on master
local unit master = GetSummoningUnit()
local unit spawn = GetSummonedUnit()
local group spawns = GetHandleGroup(master, "spawns")
// Initialize group if needed
if (spawns == null) then
    set spawns = CreateGroup()
    call SetHandleHandle(master, "spawns", spawns)
endif
// Add spawn to group
call GroupAddUnit(spawns, spawn)

// Store pointer to master on spawn
call SetHandleHandle(spawn, "master", master)



To add more GetHandle-type functions, simply copy GetHandleUnit (or another GetHandle-function) and replace the return type with another type and give it whatever name you like.

Note: In order to prevent this from leaking, replace InitGameCache with a global in the LocalVars function.
Also remember to initialize the game cache during map initialization, for example:
Code:
    call FlushGameCache(InitGameCache("cache.x"))
    set udg_GameCache=InitGameCache("cache.x")

Author
KaiserG
Guest



Back to top
Message
CommentPosted: Mon Jul 05, 2010 9:52 pm    Post subject: Reply with quote

It seems I can't add this system to my map, it keeps crashing and getting me to W3 Main Menu when I test the map before loading screen appears... pretty bad as I just wanted a simple system to link variables. Maybe am I doing something wrong? Already tried replacing the InitGameCache() with a global and setting it in the MapInit... any ideas?

Author
qweadasdasf
Guest



Back to top
Message
CommentPosted: Fri Jul 30, 2010 11:06 am    Post subject: Reply with quote

The full set of LocalHandleVars requires a global variable called lhvcache of type gamecache. You can easily create in in the TriggerEditor->Variables(Ctrl-B)

Code:
// ===========================
function H2I takes handle h returns integer
    return h
    return 0
endfunction

// Make sure to initialize the udg_lhvcache gamecache varaible in some trigger during map initialization
function InitTrig_Init_LocalHandle'Vars_Cache takes nothing returns nothing
    call FlushGameCache(InitGameCache("lhvcache.w3v"))
    set udg_lhvcache = InitGameCache("lhcache.w3v")
endfunction

// S A V E  F U N C T I O N S
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(udg_lhvcache,I2S(H2I(subject)),name)
    else
        call StoreInteger(udg_lhvcache, I2S(H2I(subject)), name, H2I(value))
    endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(udg_lhvcache,I2S(H2I(subject)),name)
    else
        call StoreInteger(udg_lhvcache, I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(udg_lhvcache,I2S(H2I(subject)),name)
    else
        call StoreBoolean(udg_lhvcache, I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(udg_lhvcache, I2S(H2I(subject)), name)
    else
        call StoreReal(udg_lhvcache, I2S(H2I(subject)), name, value)
    endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(udg_lhvcache, I2S(H2I(subject)), name)
    else
        call StoreString(udg_lhvcache, I2S(H2I(subject)), name, value)
    endif
endfunction


// G E T  F U N C T I O N S
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(udg_lhvcache, I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(udg_lhvcache, I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(udg_lhvcache, I2S(H2I(subject)), name)
endfunction
function GetHandleEvent takes handle subject, string name returns event
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayer takes handle subject, string name returns player
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDestructable takes handle subject, string name returns destructable
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleItem takes handle subject, string name returns item
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleAbility takes handle subject, string name returns ability
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleBuff takes handle subject, string name returns buff
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleForce takes handle subject, string name returns force
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTriggercondition takes handle subject, string name returns triggercondition
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTriggeraction takes handle subject, string name returns triggeraction
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLocation takes handle subject, string name returns location
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleRegion takes handle subject, string name returns region
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleRect takes handle subject, string name returns rect
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleBoolexpr takes handle subject, string name returns boolexpr
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleSound takes handle subject, string name returns sound
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleConditionfunc takes handle subject, string name returns conditionfunc
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleFilterfunc takes handle subject, string name returns filterfunc
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUnitpool takes handle subject, string name returns unitpool
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleItempool takes handle subject, string name returns itempool
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleRace takes handle subject, string name returns race
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleAlliancetype takes handle subject, string name returns alliancetype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleRacepreference takes handle subject, string name returns racepreference
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGamestate takes handle subject, string name returns gamestate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleIgamestate takes handle subject, string name returns igamestate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleFgamestate takes handle subject, string name returns fgamestate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayerstate takes handle subject, string name returns playerstate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayerscore takes handle subject, string name returns playerscore
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayergameresult takes handle subject, string name returns playergameresult
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUnitstate takes handle subject, string name returns unitstate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleAidifficulty takes handle subject, string name returns aidifficulty
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEventid takes handle subject, string name returns eventid
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGameevent takes handle subject, string name returns gameevent
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayerevent takes handle subject, string name returns playerevent
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayerunitevent takes handle subject, string name returns playerunitevent
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUnitevent takes handle subject, string name returns unitevent
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLimitop takes handle subject, string name returns limitop
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWidgetevent takes handle subject, string name returns widgetevent
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDialogevent takes handle subject, string name returns dialogevent
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUnittype takes handle subject, string name returns unittype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGamespeed takes handle subject, string name returns gamespeed
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGamedifficulty takes handle subject, string name returns gamedifficulty
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGametype takes handle subject, string name returns gametype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMapflag takes handle subject, string name returns mapflag
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMapvisibility takes handle subject, string name returns mapvisibility
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMapsetting takes handle subject, string name returns mapsetting
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMapdensity takes handle subject, string name returns mapdensity
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMapcontrol takes handle subject, string name returns mapcontrol
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayerslotstate takes handle subject, string name returns playerslotstate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleVolumegroup takes handle subject, string name returns volumegroup
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleCamerafield takes handle subject, string name returns camerafield
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleCamerasetup takes handle subject, string name returns camerasetup
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlayercolor takes handle subject, string name returns playercolor
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePlacement takes handle subject, string name returns placement
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleStartlocprio takes handle subject, string name returns startlocprio
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleRaritycontrol takes handle subject, string name returns raritycontrol
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleBlendmode takes handle subject, string name returns blendmode
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTexmapflags takes handle subject, string name returns texmapflags
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffecttype takes handle subject, string name returns effecttype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWeathereffect takes handle subject, string name returns weathereffect
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTerraindeformation takes handle subject, string name returns terraindeformation
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleFogstate takes handle subject, string name returns fogstate
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleFogmodifier takes handle subject, string name returns fogmodifier
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDialog takes handle subject, string name returns dialog
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleButton takes handle subject, string name returns button
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleQuest takes handle subject, string name returns quest
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleQuestitem takes handle subject, string name returns questitem
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDefeatcondition takes handle subject, string name returns defeatcondition
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimerdialog takes handle subject, string name returns timerdialog
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLeaderboard takes handle subject, string name returns leaderboard
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMultiboard takes handle subject, string name returns multiboard
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleMultiboarditem takes handle subject, string name returns multiboarditem
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrackable takes handle subject, string name returns trackable
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGamecache takes handle subject, string name returns gamecache
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleVersion takes handle subject, string name returns version
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleItemtype takes handle subject, string name returns itemtype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTexttag takes handle subject, string name returns texttag
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleAttacktype takes handle subject, string name returns attacktype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleDamagetype takes handle subject, string name returns damagetype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleWeapontype takes handle subject, string name returns weapontype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleSoundtype takes handle subject, string name returns soundtype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandlePathingtype takes handle subject, string name returns pathingtype
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleImage takes handle subject, string name returns image
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleUbersplat takes handle subject, string name returns ubersplat
    return GetStoredInteger(udg_lhvcache, I2S(H2I(subject)), name)
    return null
endfunction



Author
LocalHandleVars is back
Guest



Back to top
Message
CommentPosted: Mon Aug 02, 2010 7:18 am    Post subject: Reply with quote

// Make sure to initialize the udg_lhvcache hashtable varaible in some trigger like this one
// during map initialization
//function InitTrig_LocalHandleVarsInit takes nothing returns nothing
// set udg_lhvcache = InitHashtable()
//endfunction

// Note: SetHandleHandle uses an unfixed return bug like exploit to save any handle instead
// of using the native type agent and it's save native function SaveAgentHandle
// because there is no native SaveHandleHandle
// more about this return bug can be found here: www.wc3c.net/showthread.php?t=108152
// this return bug was found by weaaddar @ www.wc3c.net


Note: This renders most code that uses return bug via LocalHandleVars reusable! I tested it with "UnitAddTimedEffect" a script by KaTTaNa from 2005

Code:
function H2I takes handle h returns integer
    return GetHandleId(h)
endfunction

// S E T  F U N C T I O N S
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value == null then
        call RemoveSavedHandle(udg_lhvcache, H2I(subject), StringHash(name))
    else
        call SaveFogStateHandle(udg_lhvcache, H2I(subject), StringHash(name), ConvertFogState(H2I(value)))
    endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value == 0 then
        call RemoveSavedInteger(udg_lhvcache, H2I(subject), StringHash(name))
    else
        call SaveInteger(udg_lhvcache, H2I(subject), StringHash(name), value)
    endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
    if value == 0.0 then
        call RemoveSavedReal(udg_lhvcache, H2I(subject), StringHash(name))
    else
        call SaveReal(udg_lhvcache, H2I(subject), StringHash(name), value)
    endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
    if value == "" or value == null then
        call RemoveSavedString(udg_lhvcache, H2I(subject), StringHash(name))
    else
        call SaveStr(udg_lhvcache, H2I(subject), StringHash(name), value)
    endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value == false then
        call RemoveSavedBoolean(udg_lhvcache, H2I(subject), StringHash(name))
    else
        call SaveBoolean(udg_lhvcache, H2I(subject), StringHash(name), value)
    endif
endfunction

// G E T  F U N C T I O N S
//function GetHandleHandle takes handle subject, string name returns handle
//    return ?
//endfunction

function GetHandleInt takes handle subject, string name returns integer
    return LoadInteger(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleReal takes handle subject, string name returns real
    return LoadReal(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleString takes handle subject, string name returns string
    return LoadStr(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
    return LoadBoolean(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandlePlayer takes handle subject, string name returns player
    return LoadPlayerHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleWidget takes handle subject, string name returns widget
    return LoadWidgetHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleDestructable takes handle subject, string name returns destructable
    return LoadDestructableHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleItem takes handle subject, string name returns item
    return LoadItemHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleUnit takes handle subject, string name returns unit
    return LoadUnitHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleAbility takes handle subject, string name returns ability
    return LoadAbilityHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return LoadTimerHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return LoadTriggerHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTriggerCondition takes handle subject, string name returns triggercondition
    return LoadTriggerConditionHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTriggerAction takes handle subject, string name returns triggeraction
    return LoadTriggerActionHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTriggerEvent takes handle subject, string name returns event
    return LoadTriggerEventHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleForce takes handle subject, string name returns force
    return LoadForceHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return LoadGroupHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleLocation takes handle subject, string name returns location
    return LoadLocationHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleRect takes handle subject, string name returns rect
    return LoadRectHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleSound takes handle subject, string name returns sound
    return LoadSoundHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return LoadEffectHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleUnitPool takes handle subject, string name returns unitpool
    return LoadUnitPoolHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleItemPool takes handle subject, string name returns itempool
    return LoadItemPoolHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleQuest takes handle subject, string name returns quest
    return LoadQuestHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleQuestItem takes handle subject, string name returns questitem
    return LoadQuestItemHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleDefeatCondition takes handle subject, string name returns defeatcondition
    return LoadDefeatConditionHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTimerDialog takes handle subject, string name returns timerdialog
    return LoadTimerDialogHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleLeaderboard takes handle subject, string name returns leaderboard
    return LoadLeaderboardHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleMultiboard takes handle subject, string name returns multiboard
    return LoadMultiboardHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTrackable takes handle subject, string name returns trackable
    return LoadTrackableHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleDialog takes handle subject, string name returns dialog
    return LoadDialogHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleButton takes handle subject, string name returns button
    return LoadButtonHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleTextTag takes handle subject, string name returns texttag
    return LoadTextTagHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
    return LoadLightningHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleImage takes handle subject, string name returns image
    return LoadImageHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleUbersplat takes handle subject, string name returns ubersplat
    return LoadUbersplatHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleRegion takes handle subject, string name returns region
    return LoadRegionHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleFogState takes handle subject, string name returns fogstate
    return LoadFogStateHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleFogModifier takes handle subject, string name returns fogmodifier
    return LoadFogModifierHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction
function GetHandleHashtable takes handle subject, string name returns hashtable
    return LoadHashtableHandle(udg_lhvcache, H2I(subject), StringHash(name))
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushChildHashtable(udg_lhvcache, H2I(subject))
endfunction


Q: Is this safe to use?
A: Why yes (until blizzard fixes this return bug) ^^
Q: Does this really render most code that uses LocalHandleVars reusable?
A: Well... maybe idrk, perhaps with just little tweaks here and there : P

Display posts from previous:   
Post new topic   Reply to topic    Jass Vault -> Standard Functions All times are GMT
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot submit new scripts in this section
You can comment on scripts in this section
You cannot edit your scripts in this section
You cannot delete your scripts in this forum



FSDark by SkaidonDesigns
Powered by phpBB © 2001, 2002 phpBB Group