Mirage Source
Function problem - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Function problem (/showthread.php?tid=1527)



Function problem - Anthony - 24-01-2008

For some reason this function is constantly returning 0...

Code:
Function GetPlayerClassSprite(ByVal Index As Long) As Long
Dim Sex As Byte

    Player(Index).Char(Player(Index).CharNum).Sex = Sex
    
    If Sex = 0 Then
        GetPlayerClassSprite = Int(Class(GetPlayerClass(Index)).MSprite)
    Else
        GetPlayerClassSprite = Int(Class(GetPlayerClass(Index)).FSprite)
    End If
End Function

I have tested the GetPlayerClass(Index) elsewhere and it works fine. Also if I replace the GetPlayerClass(Index) with 1 it returns the proper numbers for thats classes sprites. Any ideas?


Re: Function problem - Dragoons Master - 24-01-2008

Code:
Function GetPlayerClassSprite(ByVal Index As Long) As Long
    If Player(Index).Char(Player(Index).CharNum).Sex = 0 Then
        GetPlayerClassSprite = Int(Class(GetPlayerClass(Index)).MSprite)
    Else
        GetPlayerClassSprite = Int(Class(GetPlayerClass(Index)).FSprite)
    End If
End Function
Thats should be correct Tongue


Re: Function problem - Anthony - 24-01-2008

I see what you did there but it didn't fix it. Thanks for making me realize my function was retarded though haha.

I guess it wasn't the function but is something else haha. I noticed now that GetPlayerClass will return 0 unless the player is logged in as that character... Duh... So how do I get the class sprite of the character 1 or 2 before I am logged in as that character?


Re: Function problem - Anthony - 24-01-2008

Thanks for all the help guys, but I ended up going a different route for what I was trying to do haha.


Re: Function problem - Dragoons Master - 25-01-2008

Hehehe, good luck.