• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Compile Errors due to Custom Script

Status
Not open for further replies.
Level 5
Joined
Jul 8, 2007
Messages
146
Please, I desperately need help. I added two custom heroes from wc3c and imported all their abilities and necessary buffs, effects, dummies, etc. After finishing to adjust the raw codes from the first one, everything worked perfect. Then I added another hero (Grim Pharaoh) and after adding all of HIS abilities, buffs, effects and dummies, I copy and pasted the necessary custom script right below the one for the first Hero (Scarlet Crusader). However, then I tried to save it and I got 345 compile errors. I don't really get why... After searching the forums for 2 hours to find a solution, I saw I had to Handle Vars or something like that but I deleted one and it still gives me errors... :sad:
Here's my current script:
JASS:
//HANDLE VARS

// ===========================
function H2I takes handle h returns integer
    return h
    return 0
endfunction
 
// ===========================
function LocalVars takes nothing returns gamecache
    if udg_cache == null then
        call FlushGameCache(InitGameCache("cach"))
        set udg_cache=InitGameCache("cach")
    endif
    return udg_cache
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction
 
function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
 
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTextTag takes handle subject, string name returns texttag
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction 
function GetHandlePlayer takes handle subject, string name returns player
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction 

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

//--------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------\\
//--------------------------------------------------------------------------------\\

function SetInt takes handle h,string n,integer v returns nothing
    if v==0 then
        call FlushStoredInteger(Cache(),I2S(H2I(h)),n)
    else
        call StoreInteger(Cache(),I2S(H2I(h)),n,v)
    endif
endfunction

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

function SetHandle takes handle subject,string name,handle value returns nothing
    call SetInt(subject,name,H2I(value))
endfunction

function GetInt takes handle subject,string name returns integer
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
endfunction

function GetReal takes handle subject,string name returns real
    return GetStoredReal(Cache(),I2S(H2I(subject)),name)
endfunction

function GetUnit takes handle subject,string name returns unit
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function GetGroup takes handle subject,string name returns group
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function GetTrigger takes handle subject,string name returns trigger
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function GetTriggerAction takes handle subject,string name returns triggeraction
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function FlushLocals takes handle subject returns nothing
    call FlushStoredMission(Cache(),I2S(H2I(subject)))
endfunction

function FlushLocal takes handle subject,string name returns nothing
    call FlushStoredInteger(Cache(),I2S(H2I(subject)),name)
endfunction

If anyone can help I'll +Rep... please help...
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
So, the scripts contained the Handle Variables more than once?
And you deleted one?
Did you delete the first one or the second one?
 
Level 5
Joined
Jul 8, 2007
Messages
146
Well, it's 2 seperate scripts. 1 was for the Scarlet Crusader, the other for the Grim Pharaoh. I initially put both scripts in entirely. But then I searched and searched the Hive forums and found that you can't have more than 1 of each function and so I deleted the Handle Variable portion of the second (Grim Pharaoh) script. However, I still get the compile errors... :(
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Ok. My psychid skills misled me - you must be far far away.
Post all the script(or attack it as a txt file).
 
Level 5
Joined
Jul 8, 2007
Messages
146
haha, ok. The whole script is this: (the ------- seperates the two seperate ones)
JASS:
//HANDLE VARS

// ===========================
function H2I takes handle h returns integer
    return h
    return 0
endfunction
 
// ===========================
function LocalVars takes nothing returns gamecache
    if udg_cache == null then
        call FlushGameCache(InitGameCache("cach"))
        set udg_cache=InitGameCache("cach")
    endif
    return udg_cache
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction
 
function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
 
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTextTag takes handle subject, string name returns texttag
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction 
function GetHandlePlayer takes handle subject, string name returns player
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction 

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

//----------------------------------------------------------------------------------------------------------------------------------------------

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

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

function Cache takes nothing returns gamecache
    if udg_cache==null then
        call FlushGameCache(InitGameCache("GameCache.x"))
        set udg_cache=InitGameCache("GameCache.x")
    endif
    return udg_cache
endfunction

function SetInt takes handle h,string n,integer v returns nothing
    if v==0 then
        call FlushStoredInteger(Cache(),I2S(H2I(h)),n)
    else
        call StoreInteger(Cache(),I2S(H2I(h)),n,v)
    endif
endfunction

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

function SetHandle takes handle subject,string name,handle value returns nothing
    call SetInt(subject,name,H2I(value))
endfunction

function GetInt takes handle subject,string name returns integer
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
endfunction

function GetReal takes handle subject,string name returns real
    return GetStoredReal(Cache(),I2S(H2I(subject)),name)
endfunction

function GetUnit takes handle subject,string name returns unit
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function GetGroup takes handle subject,string name returns group
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function GetTrigger takes handle subject,string name returns trigger
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function GetTriggerAction takes handle subject,string name returns triggeraction
    return GetStoredInteger(Cache(),I2S(H2I(subject)),name)
    return null
endfunction

function FlushLocals takes handle subject returns nothing
    call FlushStoredMission(Cache(),I2S(H2I(subject)))
endfunction

function FlushLocal takes handle subject,string name returns nothing
    call FlushStoredInteger(Cache(),I2S(H2I(subject)),name)
endfunction
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Ffs - the Handle Variable script gives you errors?
Clearly when having the same function two times would cause an error.
When I said all the script, I meant all the script that gives you errors.
When using jass I suggest using The Jass New Gen Pack.
If are using it, the compiler will state what type of compile errors you have(like Function redeclared, Missing statement - Type_of_statement)
Also note that you have to create a variable of type Game Cache with name "cache".
 
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
function LocalVars takes nothing returns gamecache
    if udg_cache == null then
        call FlushGameCache(InitGameCache("cach"))
        set udg_cache=InitGameCache("cach")
endif
    return udg_cache
endfunction

udg_cache, have u made a game cache variable named cache in the variable editor? (the yellow X)
 
Level 11
Joined
Apr 6, 2008
Messages
760
jesus that was the crappest shit ever ^^

JASS:
function InsidiousBeacon_Move takes timer t nothing returns nothing
    local timer t = GetExpiredTimer()
    //removed lots of stuff
endfunction

function InsidiousBeacon_timer takes nothing returns nothing
    call InsidiousBeacon_Move(GetExpiredTimer())
endfunction

there was ur problem 2 locals with the same name and 2x H2I functions
 
Status
Not open for further replies.
Top