Time counter not displaying last digit properly

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!

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013

    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

  • chicopchicop Member Posts: 263
    Thanks, but this one gives me a invalid expression
  • chicopchicop Member Posts: 263
    also when i apply my code to the game.time it works fine,, but on a self time it just keeps having that display issue
  • chicopchicop Member Posts: 263
    got it, it should be:

    timer every 0.1 sec
    change attribute self.Time to self.Time+0.11

    this at least gets the last digit moving
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    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

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013
    Thanks, but this one gives me a invalid expression
    also when i apply my code to the game.time it works fine,, but on a self time it just keeps having that display issue
    For the record, here's the timer I pulled from Joe's original game file; all seems to work OK. Might help (if not you, then maybe someone else..).

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.