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
964
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
964
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
964
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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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