• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Help fix the system for 1.24

Status
Not open for further replies.
Level 8
Joined
Jun 18, 2007
Messages
214
So, I'm trying to fix old shield system made my Shadow1500. Tried changing kattana's HandleVars, tried many other things and I failed. Here's a code that I tried to implement the last
JASS:
//================
function H2I takes handle h returns integer
 return GetHandleId(h)
endfunction
 
// ===========================
function LocalVars takes nothing returns gamecache
    return udg_hash
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(GetHandleId(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(GetHandleId(subject)), name, GetHandleId(value))
    endif
endfunction
 
function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(GetHandleId(subject)),name)
    else
         call StoreInteger(LocalVars(), I2S(GetHandleId(subject)), name, value)
    endif
endfunction
 
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(GetHandleId(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(GetHandleId(subject)), name, value)
    endif
endfunction
 
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(GetHandleId(subject)), name)
    else
        call StoreString(LocalVars(), I2S(GetHandleId(subject)), name, value)
    endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(), I2S(GetHandleId(subject)), name)
    else
        call StoreBoolean(LocalVars(), I2S(GetHandleId(subject)), name, true )
    endif
endfunction

function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(GetHandleId(subject)), name)
endfunction
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(GetHandleId(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(GetHandleId(subject)), name)
endfunction
 
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns  effect
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
function GetHandleTextTag takes handle subject, string name returns  texttag
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
function GetHandleTriggerAction takes handle subject, string name returns triggeraction
    return GetStoredInteger(LocalVars(), I2S(GetHandleId(subject)), name)
    call DoNothing()
    return null
endfunction
 
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(GetHandleId(subject)) )
endfunction


// Shield System
// By Shadow1500
// HandleVars by KaTTaNa

// configuration


constant function BarColor takes nothing returns string
    return "|cFF8000FF"
endfunction
constant function BarChar takes nothing returns string
    return "'"
endfunction
constant function BarLength takes nothing returns integer
    return 20
endfunction
constant function BarSize takes nothing returns real
    return 12.50
endfunction
constant function BarOffset takes nothing returns real
    return -32.00
endfunction
constant function BarOffsetY takes nothing returns real
    return -42.00
endfunction
constant function DeadFixerAbility takes nothing returns integer
    return 'A00N'
endfunction
constant function AllowDamageSpill takes nothing returns boolean
    return true
endfunction //if true then when the shield breaks it will only block some of the damage done depending on its HP
// end configuration


function DamageModify_Child takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetHandleUnit(t,"u")

    if GetHandleBoolean(t,"fix") then
        call UnitRemoveAbility( u, DeadFixerAbility() )
    endif
    call SetUnitState(u ,UNIT_STATE_LIFE, GetHandleReal(t,"finalhp") )

    set u = null
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set t = null
endfunction

// This function will "block" a certain amount of damage done to the unit
// Needs to be used in the EVENT_UNIT_DAMAGED event.
function DamageModify takes unit whichUnit, real dmg, real dmgnew returns nothing
    local timer t = CreateTimer()
    local real life = GetUnitState(whichUnit, UNIT_STATE_LIFE)
    local real maxlife = GetUnitState(whichUnit, UNIT_STATE_MAX_LIFE)
    local boolean usetimer = false
    local real dmgback = dmg-dmgnew
    local real finalhp = life-dmgnew
    if dmgnew>dmg then
        return
    endif
    if dmg > maxlife then
        call UnitAddAbility( whichUnit,DeadFixerAbility())
        call SetHandleBoolean(t, "fix", true)
        set maxlife = 1000+maxlife
        set usetimer = true
    endif
    if ( life+dmgback > maxlife ) then
        call SetUnitState(whichUnit ,UNIT_STATE_LIFE, maxlife )
        set usetimer = true
    else
        call SetUnitState(whichUnit ,UNIT_STATE_LIFE, life+dmgback )
    endif
    if usetimer then
        call SetHandleHandle(t,"u",whichUnit)
        call SetHandleReal(t,"finalhp",finalhp)
        call TimerStart(t, 0, false, function DamageModify_Child)
    else
        call DestroyTimer(t)
    endif
    set t = null
endfunction

function UpdateBar takes unit whichUnit returns nothing
    local string bar = GetHandleString(whichUnit,"scolor")
    local integer y = 0
    local real slife = GetHandleReal(whichUnit,"slife")
    local real maxslife = GetHandleReal(whichUnit,"maxslife")
    local boolean endc = false

    loop
        exitwhen y==BarLength()
        if (not endc) and (slife < (y * (maxslife/BarLength()))+1) then
            set endc = true
            set bar = bar+"|r|cFF000000"
        else
            set bar = bar+BarChar()
        endif
        set y = y + 1
    endloop
    set bar = bar+"|r"
    call SetTextTagTextBJ(GetHandleTextTag(whichUnit,"lifebar"),bar,BarSize())
endfunction
function DestroyShield takes unit whichUnit returns nothing
    local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
    local trigger trig = GetHandleTrigger(whichUnit,"shielddmg")
    local timer t = GetHandleTimer(whichUnit,"shieldtimer")
    call SetHandleBoolean(whichUnit,"sd",false)
    
    // destroy shield
    call UnitRemoveAbility(whichUnit,GetHandleInt(t,"buff"))
    call SetHandleReal(whichUnit,"slife",0)
    call SetHandleReal(whichUnit,"maxslife",0)
    call SetHandleReal(whichUnit,"reg",0)
    call SetHandleReal(whichUnit,"sarmor",0)
    call SetHandleString(whichUnit,"scolor",null)
    
    // destroy tag
    call DestroyTextTag(tag)
    call SetHandleHandle( whichUnit, "lifebar", null )
    set tag = null
    
    // destoy trigger
    call SetHandleHandle(whichUnit,"shielddmg",null)
    call TriggerRemoveAction(trig,GetHandleTriggerAction(trig,"action"))
    call FlushHandleLocals(trig)
    call DestroyTrigger(trig)
    set trig = null
    
    // destroy timer
    call SetHandleHandle(whichUnit,"shieldtimer",null)
    call PauseTimer(t)
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set t = null
endfunction
function ShieldDamage takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real dmg = GetEventDamage()
    local real slife = GetHandleReal(u,"slife")
    local real take = 1-GetHandleReal(u,"sarmor")
    if GetTriggerEventId() == EVENT_UNIT_DEATH then
        call DestroyShield(u)
        set u = null
        return
    endif
    if (slife<(dmg*take)) then
        if GetHandleBoolean(u,"sd") then
            call DestroyShield(u)
        else
            call SetHandleReal(u,"slife",0)
        endif
        if AllowDamageSpill() then
            call DamageModify(u,dmg,dmg-(slife*(1/take))) // use the remaining power of the shield to block some of the damage
        else
            call DamageModify(u,dmg,0)
        endif
    else
        call DamageModify(u,dmg,0) // block all damage
        call SetHandleReal(u,"slife",slife-(dmg*take))
        call UpdateBar(u)
    endif
    set u = null
endfunction
function CreateShield_Child takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit whichUnit = GetHandleUnit(t,"u")
    local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
    local real x = GetUnitX(whichUnit)+BarOffset()
    local real y = GetUnitY(whichUnit)+BarOffsetY()
    local integer pulse = GetHandleInt(t,"pulse")
    local real upcheck = GetHandleReal(t,"check")
    local real reg = GetHandleReal(whichUnit,"reg")
    local real slife = GetHandleReal(whichUnit,"slife")
    local real maxslife = GetHandleReal(whichUnit,"maxslife")
    local integer buffId = GetHandleInt(t,"buff")
    if (GetHandleBoolean(whichUnit,"sd") and pulse==0) or ((GetUnitAbilityLevel(whichUnit,buffId)==0) and buffId!=0) then
        call DestroyShield(whichUnit)
        set t = null
        return
    endif
    
    if reg!=0 then
       if (slife+reg)>=maxslife then
           call SetHandleReal(whichUnit,"slife",maxslife)
       else
           call SetHandleReal(whichUnit,"slife",slife+reg)
       endif
       call UpdateBar(whichUnit)
    if upcheck!=GetHandleReal(whichUnit,"slife") then
        call SetHandleReal(t,"check",GetHandleReal(whichUnit,"slife"))
        call UpdateBar(whichUnit)
    endif
    
    // countdown on how many times did timer ran
    if pulse>0 then
        call SetHandleInt(t,"pulse",pulse-1)
    endif
    
    call SetTextTagPos(tag,x,y,140)
    call SetTextTagVisibility(tag,IsUnitVisible(whichUnit,GetLocalPlayer()))

    set whichUnit = null
    set tag = null
    set t = null
endfunction
function CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill returns nothing
    // duration of -1 = shield remains on unit when depleted
    // duration of 0 = shield stays on unit until depleted
    // duration of 1 or higher = shield stays until depleted or until duration ends
    // buffId is optional
    // regenerate is the amount of points regenerated every second
    // armor must be between 0 and 1, with 1 making the shield take no damage
    // color must in blizzard's color code format
    // when dmgspill is off the shield will block all damage when depleted
    local texttag tag = GetHandleTextTag( target, "lifebar")
    local trigger whenDamaged = GetHandleTrigger(target,"shielddmg")
    local timer t = GetHandleTimer(target,"shieldtimer")
    local boolean useOld = false    
    local real x = GetUnitX(target)+BarOffset()
    local real y = GetUnitY(target)+BarOffsetY()

    if GetHandleReal(target,"slife")!=0 then
        if GetHandleInt(t,"buff")!=buffId then
            call UnitRemoveAbility(target,GetHandleInt(t,"buff"))
        endif
        call PauseTimer(t)
        call SetHandleReal(target,"reg",0)
        call SetHandleReal(target,"sarmor",0)
        call SetHandleString( target, "scolor", null)
        call DestroyTextTag(tag)
        set useOld = true
    else
        set t = CreateTimer()
        set whenDamaged = CreateTrigger()
    endif
    set tag = CreateTextTag()
    call SetHandleReal( target, "slife", shieldhp)
    call SetHandleReal( target, "maxslife", shieldhp)
    
    call SetHandleString( target, "scolor", color)
    
    // take care of the texttag
    call SetTextTagTextBJ(tag,"tag",BarSize())
    call SetTextTagPos(tag,x,y,140)
    call SetTextTagPermanent(tag,true)
    call SetTextTagColor(tag,255,255,255,255)
    call SetTextTagVisibility(tag,IsUnitVisible(target,GetLocalPlayer()))
    call SetHandleHandle( target, "lifebar", tag )
    call UpdateBar(target)
    
    // take care of the trigger
    if not useOld then
        call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DAMAGED)
        call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DEATH)
        call SetHandleHandle(whenDamaged,"action",TriggerAddAction(whenDamaged,function ShieldDamage))
        call SetHandleHandle(target,"shielddmg",whenDamaged)
    endif
    call SetHandleBoolean( whenDamaged, "dmgspill", dmgspill)

    // take care of the timer
    call SetHandleHandle( target, "shieldtimer", t)
    call SetHandleHandle( t,"u",target)
    call SetHandleReal( t, "check", shieldhp)
    if regenerate!=0 then
        call SetHandleReal(target,"reg",(regenerate)/(1/0.04))
    endif
    if armor!=0 then
        call SetHandleReal(target,"sarmor",armor)
    endif
    call SetHandleInt(t,"pulse",-1)
    if duration>=0 then
        call SetHandleBoolean( target, "sd", true)
        if duration>0 then
            call SetHandleInt(t,"pulse",R2I(duration/0.04)) 
        endif
    endif
    call SetHandleInt(t,"buff",buffId)
    
    call TimerStart(t,0.04,true,function CreateShield_Child)

    set whenDamaged = null
    set t = null
    set tag = null
endfunction
function CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor returns nothing
    call CreateShieldEx( target, shieldhp, duration, buffId, regenerate, armor, BarColor(), AllowDamageSpill())
endfunction
function CreateShieldSimple takes unit target, real shieldhp, real duration, integer buffId returns nothing
    call CreateShieldEx( target, shieldhp, duration, buffId, 0, 0, BarColor(), AllowDamageSpill())
endfunction
So I tried changing all "elseif" with "if" and putting "call DoNothing()" action in functions that have more then one return. Nothing worked, and I really need help.....
 
Use vJass, grab the old code, replace the Handle Vars section with
JASS:
/*******************************************************************************************
 Faux Handle Vars
 ----------------
    Do not use these functions for new stuff, it is just not the right thing to do...

    The intention of Faux Handle Vars is to be a patch fix for a map's migration to
  patch 1.24 This library might not cover all uses of handle vars, some of them are just
  impossible with the new rules set in patches 1.23b and 1.24, but they should work for
  most of the cases....

    All of them but the SetHandle*** ones are inline friendly. I follow the interface
  in official Kattana's handle vars from wc3jass.com, if your handle vars functions
  look different, then you were not using handle vars but another thing...

*******************************************************************************************/

//==========================================================================================
library HandleVars initializer init

 globals
    private hashtable ht
 endglobals
 
    // too bad the Handle vars' old functionality forces me to make these things
    // inline-unfriendly
    function SetHandleHandle takes agent subject,  string label, agent value returns nothing
        if(value==null) then
            call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label))
        else
            call SaveAgentHandle( ht, GetHandleId(subject), StringHash(label), value)
        endif
    endfunction

    function SetHandleInt takes agent subject, string label, integer value returns nothing
        if value==0 then
            call RemoveSavedInteger(ht, GetHandleId(subject), StringHash(label))
        else
            call SaveInteger(ht, GetHandleId(subject), StringHash(label), value)
        endif        
    endfunction

    function SetHandleBoolean takes agent subject, string label, boolean value returns nothing
        if (value == false) then
            call RemoveSavedBoolean(ht, GetHandleId(subject), StringHash(label))
        else
            call SaveBoolean(ht, GetHandleId(subject), StringHash(label), value)
        endif
    endfunction

    function SetHandleReal takes agent subject, string label, real value returns nothing
        if (value == 0.0) then
            call RemoveSavedReal(ht, GetHandleId(subject), StringHash(label))
        else
            call SaveReal(ht, GetHandleId(subject), StringHash(label), value)
        endif
    endfunction

    function SetHandleString takes agent subject, string label, string value returns nothing
        if ((value=="") or (value==null)) then
            call RemoveSavedString(ht, GetHandleId(subject), StringHash(label)) 
        else
            call SaveStr(ht, GetHandleId(subject), StringHash(label), value) //yay for blizz' consistent naming scheme...
        endif
    endfunction

    function GetHandleHandle takes agent subject, string label returns agent
        debug call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
        return null
    endfunction

    // these are inline friendly, ok, maybe they aren't because jasshelper does not recognize
    // GetHandleId as non-state changing. But they will be once I fix jasshelper...

    function GetHandleInt takes agent subject, string label returns integer
        return LoadInteger(ht, GetHandleId(subject), StringHash(label))
    endfunction

    function GetHandleBoolean takes agent subject, string label returns boolean
        return LoadBoolean(ht, GetHandleId(subject), StringHash(label))
    endfunction

    function GetHandleString takes agent subject, string label returns string
        return LoadStr(ht, GetHandleId(subject), StringHash(label))
    endfunction

    function GetHandleReal takes agent subject, string label returns real
        return LoadReal(ht, GetHandleId(subject), StringHash(label))
    endfunction

    // got bored so I now use a textmacro...
    //! textmacro FAUX_HANDLE_VARS_GetHandleHandle takes NAME, TYPE
         function SetHandle$NAME$ takes agent subject,  string label, $TYPE$ value returns nothing
             if(value==null) then
                call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label))
             else
                call Save$NAME$Handle( ht, GetHandleId(subject), StringHash(label), value)
             endif
         endfunction

         function GetHandle$NAME$ takes agent subject, string label returns $TYPE$
             return Load$NAME$Handle( ht, GetHandleId(subject), StringHash(label))
         endfunction
    //! endtextmacro
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Player","player")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Widget","widget")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Destructable","destructable")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Item","item")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Unit","unit")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ability","ability")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Timer","timer")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trigger","trigger")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerCondition","triggercondition")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerAction","triggeraction")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerEvent","event")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Force","force")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Group","group")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Location","location")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Rect","rect")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("BooleanExpr","boolexpr")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Sound","sound")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Effect","effect")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("UnitPool","unitpool")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("ItemPool","itempool")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Quest","quest")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("QuestItem","questitem")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("DefeatCondition","defeatcondition")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TimerDialog","timerdialog")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Leaderboard","leaderboard")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Multiboard","multiboard")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("MultiboardItem","multiboarditem")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trackable","trackable")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Dialog","dialog")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Button","button")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TextTag","texttag")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Lightning","lightning")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Image","image")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ubersplat","ubersplat")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Region","region")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogState","fogstate")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogModifier","fogmodifier")
    //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Hashtable","hashtable")


    function FlushHandleVars takes agent subject returns nothing
        call FlushChildHashtable(ht, GetHandleId(subject))
    endfunction
    function FlushHandleLocals takes agent subject returns nothing
        call FlushHandleVars(subject)
    endfunction


    private function init takes nothing returns nothing
        set ht=InitHashtable()
    endfunction

endlibrary
 
Last edited:
Level 8
Joined
Jun 18, 2007
Messages
214
Use vJass, grab the old code, replace the Handle Vars section with
******************************************************************************************* Faux Handle Vars ---------------- Do not use these functions for new stuff, it is just not the right thing to do... The intention of Faux Handle Vars is to be a patch fix for a map's migration to patch 1.24 This library might not cover all uses of handle vars, some of them are just impossible with the new rules set in patches 1.23b and 1.24, but they should work for most of the cases.... All of them but the SetHandle*** ones are inline friendly. I follow the interface in official Kattana's handle vars from wc3jass.com, if your handle vars functions look different, then you were not using handle vars but another thing... *******************************************************************************************/ //========================================================================================== library HandleVars initializer init globals private hashtable ht endglobals // too bad the Handle vars' old functionality forces me to make these things // inline-unfriendly function SetHandleHandle takes agent subject, string label, agent value returns nothing if(value==null) then call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label)) else call SaveAgentHandle( ht, GetHandleId(subject), StringHash(label), value) endif endfunction function SetHandleInt takes agent subject, string label, integer value returns nothing if value==0 then call RemoveSavedInteger(ht, GetHandleId(subject), StringHash(label)) else call SaveInteger(ht, GetHandleId(subject), StringHash(label), value) endif endfunction function SetHandleBoolean takes agent subject, string label, boolean value returns nothing if (value == false) then call RemoveSavedBoolean(ht, GetHandleId(subject), StringHash(label)) else call SaveBoolean(ht, GetHandleId(subject), StringHash(label), value) endif endfunction function SetHandleReal takes agent subject, string label, real value returns nothing if (value == 0.0) then call RemoveSavedReal(ht, GetHandleId(subject), StringHash(label)) else call SaveReal(ht, GetHandleId(subject), StringHash(label), value) endif endfunction function SetHandleString takes agent subject, string label, string value returns nothing if ((value=="") or (value==null)) then call RemoveSavedString(ht, GetHandleId(subject), StringHash(label)) else call SaveStr(ht, GetHandleId(subject), StringHash(label), value) //yay for blizz' consistent naming scheme... endif endfunction function GetHandleHandle takes agent subject, string label returns agent debug call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake") return null endfunction // these are inline friendly, ok, maybe they aren't because jasshelper does not recognize // GetHandleId as non-state changing. But they will be once I fix jasshelper... function GetHandleInt takes agent subject, string label returns integer return LoadInteger(ht, GetHandleId(subject), StringHash(label)) endfunction function GetHandleBoolean takes agent subject, string label returns boolean return LoadBoolean(ht, GetHandleId(subject), StringHash(label)) endfunction function GetHandleString takes agent subject, string label returns string return LoadStr(ht, GetHandleId(subject), StringHash(label)) endfunction function GetHandleReal takes agent subject, string label returns real return LoadReal(ht, GetHandleId(subject), StringHash(label)) endfunction // got bored so I now use a textmacro... //! textmacro FAUX_HANDLE_VARS_GetHandleHandle takes NAME, TYPE function SetHandle$NAME$ takes agent subject, string label, $TYPE$ value returns nothing if(value==null) then call RemoveSavedHandle( ht, GetHandleId(subject), StringHash(label)) else call Save$NAME$Handle( ht, GetHandleId(subject), StringHash(label), value) endif endfunction function GetHandle$NAME$ takes agent subject, string label returns $TYPE$ return Load$NAME$Handle( ht, GetHandleId(subject), StringHash(label)) endfunction //! endtextmacro //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Player","player") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Widget","widget") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Destructable","destructable") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Item","item") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Unit","unit") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ability","ability") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Timer","timer") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trigger","trigger") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerCondition","triggercondition") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerAction","triggeraction") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TriggerEvent","event") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Force","force") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Group","group") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Location","location") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Rect","rect") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("BooleanExpr","boolexpr") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Sound","sound") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Effect","effect") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("UnitPool","unitpool") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("ItemPool","itempool") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Quest","quest") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("QuestItem","questitem") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("DefeatCondition","defeatcondition") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TimerDialog","timerdialog") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Leaderboard","leaderboard") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Multiboard","multiboard") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("MultiboardItem","multiboarditem") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Trackable","trackable") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Dialog","dialog") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Button","button") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("TextTag","texttag") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Lightning","lightning") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Image","image") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Ubersplat","ubersplat") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Region","region") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogState","fogstate") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("FogModifier","fogmodifier") //! runtextmacro FAUX_HANDLE_VARS_GetHandleHandle("Hashtable","hashtable") function FlushHandleVars takes agent subject returns nothing call FlushChildHashtable(ht, GetHandleId(subject)) endfunction function FlushHandleLocals takes agent subject returns nothing call FlushHandleVars(subject) endfunction private function init takes nothing returns nothing set ht=InitHashtable() endfunction endlibrary
Everything except vJASS... I'm trying to find a solution in JASS, to change these codes, somehow, I was wandering maybe someone already did this..
 
Well... yeah. I guess I could convert Faux Handle Vars to normal JASS... give me a second...

BTW: I put the JASS tags on the code - it is actually proper code now :p

EDIT: Non-vJass version (really, really long code)

JASS:
//Faux HandleVars
//Created by Vexorian
//Converted to regular Jass by Element of Water

//To use, create a global Hash Table variable called FHV_Table (Ctrl+B), then use the system 
//as you'd use normal HandleVars.

function SetHandleHandle takes agent subject,string label,agent value returns nothing
    if ( value == null ) then
        call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    else
        call SaveAgentHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
    endif
endfunction

function SetHandleInt takes agent subject,string label,integer value returns nothing
    if value == 0 then
            call RemoveSavedInteger(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    else
        call SaveInteger(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
    endif
endfunction

function SetHandleBoolean takes agent subject,string label,boolean value returns nothing
    if ( value == false ) then
        call RemoveSavedBoolean(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    else
        call SaveBoolean(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
    endif
endfunction

function SetHandleReal takes agent subject,string label,real value returns nothing
    if ( value == 0.0 ) then
        call RemoveSavedReal(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    else
        call SaveReal(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
    endif
endfunction

function SetHandleString takes agent subject,string label,string value returns nothing
    if ( ( value == "" ) or ( value == null ) ) then
        call RemoveSavedString(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    else
        call SaveStr(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value) //yay for blizz' consistent naming scheme...
    endif
endfunction

function GetHandleHandle takes agent subject,string label returns agent
     call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
    return null
endfunction

function GetHandleInt takes agent subject,string label returns integer
    return LoadInteger(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction

function GetHandleBoolean takes agent subject,string label returns boolean
    return LoadBoolean(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction

function GetHandleString takes agent subject,string label returns string
    return LoadStr(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction

function GetHandleReal takes agent subject,string label returns real
    return LoadReal(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
endfunction

//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Player","player")
    function SetHandlePlayer takes agent subject,string label,player value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SavePlayerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandlePlayer takes agent subject,string label returns player
        return LoadPlayerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Player","player")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Widget","widget")
    function SetHandleWidget takes agent subject,string label,widget value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveWidgetHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleWidget takes agent subject,string label returns widget
        return LoadWidgetHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Widget","widget")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Destructable","destructable")
    function SetHandleDestructable takes agent subject,string label,destructable value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveDestructableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleDestructable takes agent subject,string label returns destructable
        return LoadDestructableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Destructable","destructable")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Item","item")
    function SetHandleItem takes agent subject,string label,item value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveItemHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleItem takes agent subject,string label returns item
        return LoadItemHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Item","item")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Unit","unit")
    function SetHandleUnit takes agent subject,string label,unit value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveUnitHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleUnit takes agent subject,string label returns unit
        return LoadUnitHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Unit","unit")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Ability","ability")
    function SetHandleAbility takes agent subject,string label,ability value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveAbilityHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleAbility takes agent subject,string label returns ability
        return LoadAbilityHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Ability","ability")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Timer","timer")
    function SetHandleTimer takes agent subject,string label,timer value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTimerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTimer takes agent subject,string label returns timer
        return LoadTimerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Timer","timer")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Trigger","trigger")
    function SetHandleTrigger takes agent subject,string label,trigger value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTriggerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTrigger takes agent subject,string label returns trigger
        return LoadTriggerHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Trigger","trigger")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("TriggerCondition","triggercondition")
    function SetHandleTriggerCondition takes agent subject,string label,triggercondition value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTriggerConditionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTriggerCondition takes agent subject,string label returns triggercondition
        return LoadTriggerConditionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("TriggerCondition","triggercondition")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("TriggerAction","triggeraction")
    function SetHandleTriggerAction takes agent subject,string label,triggeraction value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTriggerActionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTriggerAction takes agent subject,string label returns triggeraction
        return LoadTriggerActionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("TriggerAction","triggeraction")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("TriggerEvent","event")
    function SetHandleTriggerEvent takes agent subject,string label,event value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTriggerEventHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTriggerEvent takes agent subject,string label returns event
        return LoadTriggerEventHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("TriggerEvent","event")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Force","force")
    function SetHandleForce takes agent subject,string label,force value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveForceHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleForce takes agent subject,string label returns force
        return LoadForceHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Force","force")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Group","group")
    function SetHandleGroup takes agent subject,string label,group value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveGroupHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleGroup takes agent subject,string label returns group
        return LoadGroupHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Group","group")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Location","location")
    function SetHandleLocation takes agent subject,string label,location value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveLocationHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleLocation takes agent subject,string label returns location
        return LoadLocationHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Location","location")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Rect","rect")
    function SetHandleRect takes agent subject,string label,rect value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveRectHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleRect takes agent subject,string label returns rect
        return LoadRectHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Rect","rect")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("BooleanExpr","boolexpr")
    function SetHandleBooleanExpr takes agent subject,string label,boolexpr value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveBooleanExprHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleBooleanExpr takes agent subject,string label returns boolexpr
        return LoadBooleanExprHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("BooleanExpr","boolexpr")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Sound","sound")
    function SetHandleSound takes agent subject,string label,sound value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveSoundHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleSound takes agent subject,string label returns sound
        return LoadSoundHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Sound","sound")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Effect","effect")
    function SetHandleEffect takes agent subject,string label,effect value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveEffectHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleEffect takes agent subject,string label returns effect
        return LoadEffectHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Effect","effect")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("UnitPool","unitpool")
    function SetHandleUnitPool takes agent subject,string label,unitpool value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveUnitPoolHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleUnitPool takes agent subject,string label returns unitpool
        return LoadUnitPoolHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("UnitPool","unitpool")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("ItemPool","itempool")
    function SetHandleItemPool takes agent subject,string label,itempool value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveItemPoolHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleItemPool takes agent subject,string label returns itempool
        return LoadItemPoolHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("ItemPool","itempool")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Quest","quest")
    function SetHandleQuest takes agent subject,string label,quest value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveQuestHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleQuest takes agent subject,string label returns quest
        return LoadQuestHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Quest","quest")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("QuestItem","questitem")
    function SetHandleQuestItem takes agent subject,string label,questitem value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveQuestItemHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleQuestItem takes agent subject,string label returns questitem
        return LoadQuestItemHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("QuestItem","questitem")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("DefeatCondition","defeatcondition")
    function SetHandleDefeatCondition takes agent subject,string label,defeatcondition value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveDefeatConditionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleDefeatCondition takes agent subject,string label returns defeatcondition
        return LoadDefeatConditionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("DefeatCondition","defeatcondition")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("TimerDialog","timerdialog")
    function SetHandleTimerDialog takes agent subject,string label,timerdialog value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTimerDialogHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTimerDialog takes agent subject,string label returns timerdialog
        return LoadTimerDialogHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("TimerDialog","timerdialog")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Leaderboard","leaderboard")
    function SetHandleLeaderboard takes agent subject,string label,leaderboard value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveLeaderboardHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleLeaderboard takes agent subject,string label returns leaderboard
        return LoadLeaderboardHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Leaderboard","leaderboard")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Multiboard","multiboard")
    function SetHandleMultiboard takes agent subject,string label,multiboard value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveMultiboardHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleMultiboard takes agent subject,string label returns multiboard
        return LoadMultiboardHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Multiboard","multiboard")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("MultiboardItem","multiboarditem")
    function SetHandleMultiboardItem takes agent subject,string label,multiboarditem value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveMultiboardItemHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleMultiboardItem takes agent subject,string label returns multiboarditem
        return LoadMultiboardItemHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("MultiboardItem","multiboarditem")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Trackable","trackable")
    function SetHandleTrackable takes agent subject,string label,trackable value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTrackableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTrackable takes agent subject,string label returns trackable
        return LoadTrackableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Trackable","trackable")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Dialog","dialog")
    function SetHandleDialog takes agent subject,string label,dialog value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveDialogHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleDialog takes agent subject,string label returns dialog
        return LoadDialogHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Dialog","dialog")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Button","button")
    function SetHandleButton takes agent subject,string label,button value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveButtonHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleButton takes agent subject,string label returns button
        return LoadButtonHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Button","button")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("TextTag","texttag")
    function SetHandleTextTag takes agent subject,string label,texttag value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveTextTagHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleTextTag takes agent subject,string label returns texttag
        return LoadTextTagHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("TextTag","texttag")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Lightning","lightning")
    function SetHandleLightning takes agent subject,string label,lightning value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveLightningHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleLightning takes agent subject,string label returns lightning
        return LoadLightningHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Lightning","lightning")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Image","image")
    function SetHandleImage takes agent subject,string label,image value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveImageHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleImage takes agent subject,string label returns image
        return LoadImageHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Image","image")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Ubersplat","ubersplat")
    function SetHandleUbersplat takes agent subject,string label,ubersplat value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveUbersplatHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleUbersplat takes agent subject,string label returns ubersplat
        return LoadUbersplatHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Ubersplat","ubersplat")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Region","region")
    function SetHandleRegion takes agent subject,string label,region value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveRegionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleRegion takes agent subject,string label returns region
        return LoadRegionHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Region","region")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("FogState","fogstate")
    function SetHandleFogState takes agent subject,string label,fogstate value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveFogStateHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleFogState takes agent subject,string label returns fogstate
        return LoadFogStateHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("FogState","fogstate")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("FogModifier","fogmodifier")
    function SetHandleFogModifier takes agent subject,string label,fogmodifier value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveFogModifierHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleFogModifier takes agent subject,string label returns fogmodifier
        return LoadFogModifierHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("FogModifier","fogmodifier")
//textmacro instance: FAUX_HANDLE_VARS_GetHandleHandle("Hashtable","hashtable")
    function SetHandleHashtable takes agent subject,string label,hashtable value returns nothing
        if ( value == null ) then
            call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
        else
            call SaveHashtableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
        endif
    endfunction

    function GetHandleHashtable takes agent subject,string label returns hashtable
        return LoadHashtableHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
    endfunction
//end of: FAUX_HANDLE_VARS_GetHandleHandle("Hashtable","hashtable")


function FlushHandleVars takes agent subject returns nothing
    call FlushChildHashtable(udg_FHV_Table , GetHandleId(subject))
endfunction
    
function FlushHandleLocals takes agent subject returns nothing
    call FlushHandleVars(subject)
endfunction

function InitTrig_Faux_HandleVars takes nothing returns nothing
    set udg_FHV_Table = InitHashtable()
endfunction

EDIT2: I forgot to mention - this uses a global Hash Table variable called FHV_Table. You need to create it in the GUI variables.
 
Last edited:
Well, JassCraft gives errors because the code uses new natives and JassCraft is outdated.

And the line you showed for the world editor error isn't even in the code, so I don't understand how you got that. Just copy and paste the system as it is, DO NOT change anything. It works as it is, it only needs that global variable. You don't need to assign anything yourself...
 
Level 3
Joined
Mar 24, 2006
Messages
7
I have similar problem with 2 of the jass spells in my map going to 1.24b and I need some help. A created a Hashtable variable FHV_Table, then I copied the new function:
function SetHandleHandle takes agent subject,string label,agent value returns nothing
if ( value == null ) then
call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveAgentHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
endif
endfunction

and then I have the following errors compiling with WE:

call SetHandleHandle( target, "lifebar", tag ) //invalid argument type (text tag)
call SetHandleHandle(target,"shielddmg",whenDamaged) ) //invalid argument type (trigger action)
call SetHandleHandle(t, "light", lightning) //invalid argument type (lightning)

I see there are some new jass functions in the patch 1.24b. Maybe the function SetHandleHandle has to be modified to include the argument types that I need like SaveTriggerActionHandle, SaveTextTagHandle and
SaveLightningHandle
So, do I have to change the SetHandleHandle function or the problem is somewhere else?
 
Level 8
Joined
Jun 18, 2007
Messages
214
I have similar problem with 2 of the jass spells in my map going to 1.24b and I need some help. A created a Hashtable variable FHV_Table, then I copied the new function:
function SetHandleHandle takes agent subject,string label,agent value returns nothing
if ( value == null ) then
call RemoveSavedHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label))
else
call SaveAgentHandle(udg_FHV_Table , GetHandleId(subject) , StringHash(label) , value)
endif
endfunction

and then I have the following errors compiling with WE:

call SetHandleHandle( target, "lifebar", tag ) //invalid argument type (text tag)
call SetHandleHandle(target,"shielddmg",whenDamaged) ) //invalid argument type (trigger action)
call SetHandleHandle(t, "light", lightning) //invalid argument type (lightning)

I see there are some new jass functions in the patch 1.24b. Maybe the function SetHandleHandle has to be modified to include the argument types that I need like SaveTriggerActionHandle, SaveTextTagHandle and
SaveLightningHandle
So, do I have to change the SetHandleHandle function or the problem is somewhere else?

Don't use this at all, forget what we discussed in the post. It's very old.
Now, you don't need to use HandleVars anymore, 1.24b patch brought hashtables. What you need to do is create a global variable of type hashtable, name it what you like, and in your map init trigger (or the init of the spell or a system) add set udg_YourHash = InitHashtable().
In that hashtable you can save what you want.
That may include:

SaveUnitHandle(hashtable, parentKey, childKey, whichUnit)
SaveReal(hashtable, parentKey, chidKey, realNumber)
SaveGroupHandle(hashtable, parentKey, childKey, whichGroup)

ParentKey and ChildKey are integers. It's like a 2D array. For the parent key, usually a timer is tied, for the childKey it can be any integer like: 0, 1, 2, 320.... So If I want to store a unit in hashtable it would be:
SaveUnitHandle(udg_Hash, GetHandleId(someTimer), 1, someUnit)
and now after I store it, in the other trigger(function), that I want to use it I would do this: LoadUnitHandle(udg_Hash, GetHandleId(sameTimer), 1)

GetHandleId, gives a unique number for all handle types. That could include: units, timers, groups, location, lightning. But timers are most common use, since we start it in one trigger, and in the next one we use for example local timer t = GetExpiredTimer().

Don't forget to FlushChildHashtable(yourHash, parentKey) after use, so you could remove all leaks.
 
Level 3
Joined
Mar 24, 2006
Messages
7
Thank you Shdow89 for the post. I figured it out how it should be. But I had to go through this stuff because I had 4 jass spells that didn’t comply with the new standard. This thread was helpful for the fixing. Thanks to Element of Water too.
 
Status
Not open for further replies.
Top