how to change H2I to GethandleId

R 3 T R O

New Member
Reaction score
12
I'm sorry not sure if there was any other posts regarding this but 2 years ago i had a good friend make all the triggers in my map and i did the rest of the map but now im hearing that people with the return bug will to need to change it. Im not really good at jass i know 1 or 2 things but very simple things. and i know for a fact that i have H2I, I2H, I2S, I2T used in my map

How would i go about changing those so they work for the new patch.
would it be like this

Original
JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction


would this be the fix for it?
JASS:
function GetHandleId takes handle h returns integer
    return h
    return 0
endfunction


and how about for I2H, I2S, I2T would those need to be changed aswell?

Thank you very much in advance
 

Romek

Super Moderator
Reaction score
963
I2H, I2T, etc are all sucky functions which shouldn't be used anyway. Find an alternative for them (Structs being one).

To switch from H2I to GetHandleId, simply remove the H2I function from your map, and replace every H2I call in your map with GetHandleId.
S2I becomes StringHash.

A simple find+replace does the job.
 

R 3 T R O

New Member
Reaction score
12
hey

Thanks for the quick reply. But thats the problem i dont know how to change it, Im not expecting nayone to do it for me, but just to visually show me how.

would this be the fix for it?
JASS:
function GetHandleId takes handle h returns integer
    return h
    return 0
endfunction


anyway this is the trigger with all those fuctions

JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction

function FlushHandleLocals takes handle h returns nothing
    call FlushStoredMission(udg_gc_handlevars, I2S(H2I(h)) )
endfunction

function SetHandleInteger takes handle h, string name, integer i returns nothing
    call StoreInteger(udg_gc_handlevars, I2S(H2I(h)), name, i)
endfunction

function GetHandleInteger takes handle h, string name returns integer
    return GetStoredInteger(udg_gc_handlevars, I2S(H2I(h)),name)
endfunction

function SetHandleReal takes handle h, string name, real r returns nothing
    call StoreReal(udg_gc_handlevars, I2S(H2I(h)), name, r)
endfunction

function GetHandleReal takes handle h, string name returns real
    return GetStoredReal(udg_gc_handlevars, I2S(H2I(h)),name)
endfunction

function SetHandleHandle takes handle h, string name, handle value returns nothing
    call StoreInteger(udg_gc_handlevars, I2S(H2I(h)), name, H2I(value))
endfunction

function GetHandleUnit takes handle h, string name returns unit
    return GetStoredInteger(udg_gc_handlevars, I2S(H2I(h)),name)
    return null
endfunction

function SetHandleBoolean takes handle h, string name, boolean b returns nothing
    call StoreBoolean(udg_gc_handlevars, I2S(H2I(h)), name, b)
endfunction

function GetHandleBoolean takes handle h, string name returns boolean
    return GetStoredBoolean(udg_gc_handlevars, I2S(H2I(h)),name)
endfunction

function SetHandleString takes handle h, string name, string s returns nothing
    call StoreString(udg_gc_handlevars, I2S(H2I(h)), name, s)
endfunction

function GetHandleString takes handle h, string name returns string
    return GetStoredString(udg_gc_handlevars, I2S(H2I(h)),name)
endfunction

function GetHandleForce takes handle h, string name returns force
    return GetStoredInteger(udg_gc_handlevars, I2S(H2I(h)),name)
    return null
endfunction

function GetHandleWeatherEffect takes handle h, string name returns weathereffect
    return GetStoredInteger(udg_gc_handlevars, I2S(H2I(h)),name)
    return null
endfunction

function GetHandleLocation takes handle h, string name returns location
    return GetStoredInteger(udg_gc_handlevars,I2S(H2I(h)),name)
    return null
endfunction

function GetHandlePlayer takes handle h, string name returns player
    return GetStoredInteger(udg_gc_handlevars,I2S(H2I(h)),name)
    return null
endfunction

function GetHandleTimer takes handle h, string name returns timer
    return GetStoredInteger(udg_gc_handlevars, I2S(H2I(h)),name)
    return null
endfunction

function GetHandleTriggerAction takes handle h, string name returns triggeraction
    return GetStoredInteger(udg_gc_handlevars,I2S(H2I(h)),name)
    return null
endfunction

function InitializeArrayType takes nothing returns nothing
    set udg_gc_array = InitGameCache("arrays.w3v")
endfunction

function CreateArray takes string name returns nothing
    call StoreInteger(udg_gc_array,name,"n",0)
endfunction

function GetLength takes string name returns integer
    return GetStoredInteger(udg_gc_array,name,"n")
endfunction

function AddItemToArray takes string name, integer x returns nothing
    local integer i = GetLength(name) + 1
    call StoreInteger(udg_gc_array,name,I2S(i),x)
    call StoreInteger(udg_gc_array,name,"n",i)
endfunction

function GetI takes string name, integer i returns integer
    return GetStoredInteger(udg_gc_array,name,I2S(i))
endfunction

function SetI takes string name, integer i, integer x returns nothing
    call StoreInteger(udg_gc_array,name,I2S(i),x)
endfunction

function SetS takes string name, integer i, string s returns nothing
    call StoreString(udg_gc_array,name,I2S(i),s)
endfunction

function GetS takes string name, integer i returns string
    return GetStoredString(udg_gc_array,name,I2S(i))
endfunction

function I2T takes integer i returns timer
    return i
    return null
endfunction
 

Romek

Super Moderator
Reaction score
963
Read this;

Followed by this.

Structs can be passed as integers, so use some system that can attach integers to handles.
TimerUtils, ABC, etc are some that come to mind.
Some systems such as KT2 or TT do all the timer stuff internally, so you just need to pass a period, a callback function, and the data to attach. :)
 

R 3 T R O

New Member
Reaction score
12
lol

Ugh i dont get any of those tutorials to be honest with you man, i dont know jass, my buddy did all the jass for me but he quit war3. leaving me doing what i can,,, so when i was reading that tutorial i didnt get any of it. but how wil those tutorials help me change H2I to GetHandleId or is structs the same as H2I but i still need to find a way to change the H21

Im sorry Romak i really know your trying to help. and the stuff your giving me to do might acauly do it but its like teaching someone level 5 math with the person only knows level 0.1 lol

But thanks for your effort i appreciate it

"simply remove the H2I function from your map, and replace every H2I call in your map with GetHandleId.
S2I becomes StringHash" i know what ur saying but i dont see it in my head on how to do it could you show me it with the site's Jass tags
JASS:
so this way i can see it acauly being changed from an H2I to GethandleId so i can kinda like copy over to mine
 

Cookiemaster

New Member
Reaction score
36
You could just be really lazy and change

JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction


to:

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


AKA, the lazy and inefficient way.



But it is better to just replace all the H2I calls with GetHandleId, as previously mentioned in the thread.
 

Romek

Super Moderator
Reaction score
963
I think he got that part.
Just the I2H stuff is difficult.

I assumed you knew Jass.
Check out my tutorial for some basic stuff. :)
 

R 3 T R O

New Member
Reaction score
12
ugh

i keep getting over 5000 syntax errors lol, Im a lost case.

This is what i have rit now

and yes i do have the new patch

But thanks for the help guys, I guess im going to have to delete all my triggers and start over :(:thdown::thdown:

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

function FlushHandleLocals takes handle h returns nothing
    call FlushStoredMission(udg_gc_handlevars, I2S(GetHandleId(h)) )
endfunction

function SetHandleInteger takes handle h, string name, integer i returns nothing
    call StoreInteger(udg_gc_handlevars, I2S(GetHandleId(h)), name, i)
endfunction

function GetHandleInteger takes handle h, string name returns integer
    return GetStoredInteger(udg_gc_handlevars, I2S(GetHandleId(h)),name)
endfunction

function SetHandleReal takes handle h, string name, real r returns nothing
    call StoreReal(udg_gc_handlevars, I2S(GetHandleId(h)), name, r)
endfunction

function GetHandleReal takes handle h, string name returns real
    return GetStoredReal(udg_gc_handlevars, I2S(GetHandleId(h)),name)
endfunction

function SetHandleHandle takes handle h, string name, handle value returns nothing
    call StoreInteger(udg_gc_handlevars, I2S(GetHandleId(h)), name, GetHandleId(value))
endfunction

function GetHandleUnit takes handle h, string name returns unit
    return GetStoredInteger(udg_gc_handlevars, I2S(GetHandleId(h)),name)
    return null
endfunction

function SetHandleBoolean takes handle h, string name, boolean b returns nothing
    call StoreBoolean(udg_gc_handlevars, I2S(GetHandleId(h)), name, b)
endfunction

function GetHandleBoolean takes handle h, string name returns boolean
    return GetStoredBoolean(udg_gc_handlevars, I2S(GetHandleId(h)),name)
endfunction

function SetHandleString takes handle h, string name, string s returns nothing
    call StoreString(udg_gc_handlevars, I2S(GetHandleId(h)), name, s)
endfunction

function GetHandleString takes handle h, string name returns string
    return GetStoredString(udg_gc_handlevars, I2S(GetHandleId(h)),name)
endfunction

function GetHandleForce takes handle h, string name returns force
    return GetStoredInteger(udg_gc_handlevars, I2S(GetHandleId(h)),name)
    return null
endfunction

function GetHandleWeatherEffect takes handle h, string name returns weathereffect
    return GetStoredInteger(udg_gc_handlevars, I2S(GetHandleId(h)),name)
    return null
endfunction

function GetHandleLocation takes handle h, string name returns location
    return GetStoredInteger(udg_gc_handlevars,I2S(GetHandleId(h)),name)
    return null
endfunction

function GetHandlePlayer takes handle h, string name returns player
    return GetStoredInteger(udg_gc_handlevars,I2S(GetHandleId(h)),name)
    return null
endfunction

function GetHandleTimer takes handle h, string name returns timer
    return GetStoredInteger(udg_gc_handlevars, I2S(GetHandleId(h)),name)
    return null
endfunction

function GetHandleTriggerAction takes handle h, string name returns triggeraction
    return GetStoredInteger(udg_gc_handlevars,I2S(GetHandleId(h)),name)
    return null
endfunction

function InitializeArrayType takes nothing returns nothing
    set udg_gc_array = InitGameCache("arrays.w3v")
endfunction

function CreateArray takes string name returns nothing
    call StoreInteger(udg_gc_array,name,"n",0)
endfunction

function GetLength takes string name returns integer
    return GetStoredInteger(udg_gc_array,name,"n")
endfunction

function AddItemToArray takes string name, integer x returns nothing
    local integer i = GetLength(name) + 1
    call StoreInteger(udg_gc_array,name,I2S(i),x)
    call StoreInteger(udg_gc_array,name,"n",i)
endfunction

function GetI takes string name, integer i returns integer
    return GetStoredInteger(udg_gc_array,name,I2S(i))
endfunction

function SetI takes string name, integer i, integer x returns nothing
    call StoreInteger(udg_gc_array,name,I2S(i),x)
endfunction

function SetS takes string name, integer i, string s returns nothing
    call StoreString(udg_gc_array,name,I2S(i),s)
endfunction

function GetS takes string name, integer i returns string
    return GetStoredString(udg_gc_array,name,I2S(i))
endfunction

function I2T takes integer i returns timer
    return i
    return null
endfunction
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
This is unneeded AFAIK:
JASS:
function GetHandleId takes handle h returns integer
    return GetHandleId(h)
endfunction

Also, you're still using the return bug in certain places.
What's all this for anyways?
It's very messy.

You can't have functions of the same name like that. Keep it like this:

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


This will give you syntax errors until the next patch comes out.
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
function H2I takes handle h returns integer
    return GetHandleId(h)
endfunction

function FlushHandleLocals takes handle h returns nothing
    call FlushChildHashtable(udg_gc_handlevars, H2I(h) )
endfunction

function SetHandleInteger takes handle h, string name, integer i returns nothing
    call SaveInteger(udg_gc_handlevars, H2I(h), StringHash(name), i)
endfunction

...

Anyone wanna finish it? And the global var needs to be changed to an initialized hashtable. :)

Just trying to help people help this guy... lol...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top