Thread Tools Display Modes
Prev Previous Post   Next Post Next
04/17/19, 05:11 PM   #1
Supportic
Join Date: Mar 2019
Posts: 24
Countdown / wait till function is done

Hey, I just wonder if there is a way to pause a for-loop between every item.
My current approach is:

Lua Code:
  1. local function sleep(s)
  2.   local futureTime = GetGameTimeSeconds() + s
  3.  
  4.   while GetGameTimeSeconds() < futureTime do end
  5. end
  6.  
  7. local function testSounds()
  8.   local duration = 5
  9.   local count = 1;
  10.  
  11.   for key, value in pairs(UAN.Sounds) do
  12.     PlaySound(value)
  13.     Util.p("[%d]: %s", count, key)
  14.     count = count + 1
  15.     sleep(duration)
  16.   end
  17. end

But the for-loop is so fast, that it stacks all sleep-calls and causes to freeze the game. x)

Last edited by Supportic : 04/17/19 at 05:13 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Countdown / wait till function is done


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off