how would I do this:
player(1)\lives = 0
by passing the variable to a function ?
eg.
reset_life( player(1)\lives )
.
.
.
function reset_life ( param )
param = 0
end function
Type TExample
Field param
End Type
Function FunctionExample(t.TExample)
t\param=0
End Function
EDIT: Just updated it :)
erm...like this?
player(1)\lives = reset_life()
.
.
.
function reset_life%()
Return 0
end function
or like this:
reset_lives(player(1))
.
.
.
Function reset_lives(player.playertype)
player\lives = 0
End function
Maybe I'm not understanding exactly what you are trying to do?
but per your example, this wouldn't work either:
A% = 1
Print A
increase_variable(A)
Print A
Function increase_variable(param)
param = param + 1
End function
here's what I'm trying to do.
Type playerdata
Field speed
Field strength
End Type
Dim player.playerdata(4)
player.playedate(1) = New playerdata
player.playedate(2) = New playerdata
player(1)\strength=1
player(2)\strength=7
increment_lives ( player(1)\strength )
increment_lives ( player(2)\strength )
;------------------------
Function increment_lives ( somethinghere )
somethinghere = somethinghere + 1
eg. player(1)\strength = player(1)\strength + 1
End Function
;-------------------------
I want the function to take whatever type variable I pass it and increment it.
Type playerdata
Field speed
Field strength
End Type
Dim player.playerdata(4)
player.playedate(1) = New playerdata
player.playedate(2) = New playerdata
player(1)\strength=1
player(2)\strength=7
increment_lives ( player(1))
increment_lives ( player(2))
;------------------------
Function increment_lives ( somethinghere.playerdata )
somethinghere\strength = somethinghere\strength + 1
End Function
;-------------------------
cool - thanks for that
types are a little new to me!