Quote: "Any suggestions for making it so i dont have to write out all the stats for every function?"
I think arrays can be useful here. Ie.
You have 3 characters: Matt, Tom, and Joe; and the stats: Health, Agility and Mana.
` Character IDs (makes dealing with stat arrays easier for the eye)
Matt_ID = 0 : Tom_ID = 1 : Joe_ID = 2
` Stat arrays
Dim Health(2) : Dim Agility(2) : Dim Mana(2)
` Some functon to read write the stats
function SetHealth(Character$, Value)
Select Character$
Case "Matt" : ID = Matt_ID : EndCase
Case "Tom" : ID = Tom_ID : EndCase
Case "Joe" : ID = Joe_ID : EndCase
EndSelect
Health(ID) = Value
endfunction
function GetHealth(Character$)
Select Character$
Case "Matt" : ID = Matt_ID : EndCase
Case "Tom" : ID = Tom_ID : EndCase
Case "Joe" : ID = Joe_ID : EndCase
EndSelect
result = Health(ID)
endfunction result
Or you use one 2 dimensional stat array (provided all stats take the same data type; in this case Integers)
` Character IDs (makes dealing with stat array easier for the eye)
Matt_ID = 0 : Tom_ID = 1 : Joe_ID = 2
` Stat IDs (same reason as above)
Health_ID = 0 : Agility_ID = 1 : Mana_ID = 2
` a 2-dimensional stat array
Dim Stats(2,2)
function SetStats(Character$, Stat_ID, Value)
Select Character$
Case "Matt" : Char_ID = Matt_ID : EndCase
Case "Tom" : Char_ID = Tom_ID : EndCase
Case "Joe" : Char_ID = Joe_ID : EndCase
EndSelect
Stats(Stat_ID, Char_ID) = Value
endfunction
function GetStats(Character$, Stat_ID)
Select Character$
Case "Matt" : Char_ID = Matt_ID : EndCase
Case "Tom" : Char_ID = Tom_ID : EndCase
Case "Joe" : Char_ID = Joe_ID : EndCase
EndSelect
result = Stats(Stat_ID, Char_ID)
endfunction result
If you use character IDs instead of names you can drop the Select/Case block
function SetStats(Char_ID, Stat_ID, Value)
Stats(Stat_ID,Char_ID) = Value
endfunction