Author Topic: Is there any form of sleep or delay function?  (Read 2332 times)

0 Members and 1 Guest are viewing this topic.

Offline Roondak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 54
  • Rating: +4/-3
    • View Profile
Is there any form of sleep or delay function?
« on: March 24, 2014, 10:15:05 pm »
I was wondering what the best way to delay the system would be. Would it be calling a timer and using that as your delay? Would it be putting the system in a while loop until timer.getMilliSecCounter() returns a certain value?

I was wondering how to do this to make text look as if it's being typed in, like in many RPG games.
EDIT: Got this working with timer, not sure if there's a better way to do this.
« Last Edit: March 25, 2014, 12:00:22 am by Roondak »

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Is there any form of sleep or delay function?
« Reply #1 on: March 25, 2014, 02:16:19 am »
I thought there was a function for that. Long time since I've done lua but I'm pretty sure lua itself brings sleep(time).

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Is there any form of sleep or delay function?
« Reply #2 on: March 25, 2014, 04:54:37 am »
As TI-Nspire Lua framework is event based, it wouldn't be 'correct' to have blocking calls such as delay/sleep (hence they are not implemented). So your best bet would be using the timer and on.timer event (possibly in combination with timer.getMilliSecCounter, depending on what you have to do).