HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Functions Returning

03-02-2007, 09:32 PM#1
Rising_Dusk
Okay.
I'm using vJass, to start this off.

Collapse JASS:
function GetProperName takes unit Hero returns string
    if Hero == Victor then
        return "Victor"
    elseif Hero == Sozen then
        return "Sozen"
    elseif Hero == ArroKree then
        return "Arró Kree"
    elseif Hero == Stille then
        return "Stille"
    endif
    
    if Hero == Vert then
        return "Vertejaune"
    elseif Hero == Caliga then
        return "Caliga Err'"
    elseif Hero == Genobee then
        return "Genobee"
    endif
    return "OMGIMONFIRE"
endfunction
Collapse JASS:
function SetHeroEffects takes unit Hero,unit Dummy returns nothing
    if Hero == Victor then
        call SetUnitColor(Dummy , PLAYER_COLOR_LIGHT_GRAY)
    elseif Hero == Sozen then
        call SetUnitColor(Dummy , PLAYER_COLOR_ORANGE)
    elseif Hero == ArroKree then
        call SetUnitColor(Dummy , PLAYER_COLOR_RED)
    elseif Hero == Stille then
        call SetUnitColor(Dummy , PLAYER_COLOR_LIGHT_BLUE)
    endif
    
    if Hero == Vert then
        call SetUnitColor(Dummy , PLAYER_COLOR_RED)
    elseif Hero == Caliga then
        call SetUnitColor(Dummy , PLAYER_COLOR_LIGHT_GRAY)
    elseif Hero == Genobee then
        call SetUnitColor(Dummy , PLAYER_COLOR_PURPLE)
    endif
endfunction

Okay, now before you tell me "uninitialized variables," I did a check RIGHT before calling these functions.
It tells me the variables are properly initialized.

Is there something silly I'm overlooking, or what?
03-02-2007, 10:07 PM#2
Captain Griffen
Sure all the globals are inited?

You also forgot to say what the problem was.
03-02-2007, 10:09 PM#3
Ammorth
I'm confused as to what the problem is? Is the function always returning "OMGIMONFIRE"?
03-02-2007, 10:10 PM#4
Rising_Dusk
The problem is in the title, the functions are causing the thread to crash and return prematurely.
They are not returning anything at all, it crashes the thread.

And I'm 100% positive the globals are initialized.
That was my first guess to the problem, but they're all perfectly fine.

EDIT!
Nevermind, I'm a retard.
I figured it out, I had a chance to divide by zero the line before the function was called.
And I put my debug before that. Doh!
03-03-2007, 01:55 AM#5
PipeDream
Grimoire, baby.
03-03-2007, 01:32 PM#6
emjlr3
indeed :)