get os.time or timer with lua

  • #1, by andy-rinaldiTuesday, 17. February 2015, 20:11 9 years ago
    Hello,
    I need to show a simple timer or os.time in my scene but I don't know like do it and the variable type.
    number type: v=variable
    string type: vs=variable
    time type: ???

    thanks.

    Forum Fan

    160 Posts


  • #2, by afrlmeTuesday, 17. February 2015, 20:27 9 years ago
    There is no time type for the displayed texts. You can only include the integer or string value of an existing value. You could write the time into a value though. The string section of a value would be better than the integer section as you would be able to include formatting.

    What is this timer for?

    os.date("%X") -- return players os time in 24 hour format (hh:mm:ss)
    

    Imperator

    7278 Posts

  • #3, by andy-rinaldiTuesday, 17. February 2015, 22:28 9 years ago
    Hi Lee, it's your timer script that not works grin. When I quit the option menu, the timer resets to 0 every time.

    Forum Fan

    160 Posts

  • #4, by afrlmeTuesday, 17. February 2015, 22:37 9 years ago
    Ah that old chestnut again eh! grin

    I wrote that script ages ago. Not sure why it should be resetting itself though, unless you are reinitializing the script by calling it each time you load the menu scene.

    Imperator

    7278 Posts