• 🏆 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!

Need help with JASS code.

Status
Not open for further replies.
Level 1
Joined
Feb 24, 2009
Messages
3
Hiho, I've been trying to make some older maps compatible with 1.24 and while trying to fix one I've encountered a brick wall. If anyone could go through this code and tell me how to fix it, or even fix it if possible, I'd be very grateful.

Code:
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
function HtoR takes handle h returns real
return h
return 0.
endfunction
function RtoL takes real r returns location
return r
return null
endfunction
function RtoI takes real r returns integer
return r
return 0
endfunction
function ItoR takes integer i returns real
return i
return 0.
endfunction
function HtoI takes handle h returns integer
return h
return 0
endfunction
 
Level 7
Joined
Apr 5, 2006
Messages
128
JASS:
globals
    hashtable MyHash = InitHashtable()
endglobals

function Handle2Int takes handle h returns integer
    return GetHandleId(h)
endfunction

function Int2Group takes integer i returns group
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadGroupHandle(MyHash,0,0)
endfunction

function Int2Unit takes integer i returns unit
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadUnitHandle(MyHash,0,0)
endfunction

function Int2Location takes integer i returns location
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadLocationHandle(MyHash,0,0)
endfunction

function Int2Effect takes integer i returns effect
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadEffectHandle(MyHash,0,0)
endfunction

function Int2Timer takes integer i returns timer
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadTimerHandle(MyHash,0,0)
endfunction

//function Int2Terraindeformation takes integer i returns terraindeformation
//    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
//    return LoadGroupHandle(MyHash,0,0)
//endfunction
//Lol there is no save/load for terrain deformations, so we are stuck.
//There is another way to typecast, known as the "Return Nothing" bug [discovered by Deaod]
//However, it no longer works.

function Int2Destructable takes integer i returns destructable
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadDestructableHandle(MyHash,0,0)
endfunction

function Int2Trigger takes integer i returns trigger
    call SaveFogStateHandle(MyHash,0,0,ConvertFogState(i))
    return LoadTriggerHandle(MyHash,0,0)
endfunction

It's not complete but should look like it. Credits to PurgeandFire111
 
Level 1
Joined
Feb 24, 2009
Messages
3
Yeah, been thinking about scrapping it, but my knowledge isn't enough to do it. I just couldn't do it, also, doesn't seem like I'll fix it. Tried to do it according to the guide, to no avail.
 
Status
Not open for further replies.
Top