Time counter not displaying last digit properly
chicop
Member Posts: 263
Hi!
Thank you for checking out this post.
I am trying to make a timer that keeps track of the players flight time in this case. my code is as follows:
I made a actor with a Time real attribute inside
Then on rule
attribute game.gamestart is true
timer every 0.1 sec
change attribute self.Time to self.Time+0.1
Display text:
floor((floor(( self.Time )%3600)/60)%10)..":"..floor((( self.Time )%60)/10)..floor(( self.Time )%10)..":"..(floor(( self.Time )*10)%10)..floor(floor(( self.Time )*100)%10)
all this works great except for one thing, the last digit in the time display (mili sec) only shows a 0 or a 9
so 0:41:40 or 0:41:49 basically it os not showing 1 to 8 when displaying the counter. How can i fix this or has any one seen this happen?
thanks!
Thank you for checking out this post.
I am trying to make a timer that keeps track of the players flight time in this case. my code is as follows:
I made a actor with a Time real attribute inside
Then on rule
attribute game.gamestart is true
timer every 0.1 sec
change attribute self.Time to self.Time+0.1
Display text:
floor((floor(( self.Time )%3600)/60)%10)..":"..floor((( self.Time )%60)/10)..floor(( self.Time )%10)..":"..(floor(( self.Time )*10)%10)..floor(floor(( self.Time )*100)%10)
all this works great except for one thing, the last digit in the time display (mili sec) only shows a 0 or a 9
so 0:41:40 or 0:41:49 basically it os not showing 1 to 8 when displaying the counter. How can i fix this or has any one seen this happen?
thanks!
Comments
Hi @chicop
Maybe try it slightly differently; here's one set from Joe @FireMapleGames (I wonder how he's doing?) from a game file test way back when.
Just replace game.time with self.time of course:
floor( game.Time /3600)..":"..floor(floor(( game.Time %3600)/60)/10)..floor((floor( game.Time %3600)/60)%10)..":"..floor(( game.Time %60)/10)..floor( game.Time %10).."."..(floor( game.Time *10))%10)
Hope that sorts it for you.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
timer every 0.1 sec
change attribute self.Time to self.Time+0.11
this at least gets the last digit moving
OK, I tried ;-) Glad you got it sorted.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps