Scripts / Freeze or wait command

Author
Message
VRGames
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: The Netherlands
Posted: 6th Jun 2014 09:47
Is there a freeze or wait command in LUA to slower down a loop in LUA.

example

Global: a = 1

while (a < 5000)
do
wait or freeze??
a = a + 1
end


Thanks and greetings
PM
Dralel
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 4th Nov 2013
Location: UK
Posted: 6th Jun 2014 10:13
Would like to know too.

GPU: GTX 660, CPU: i7 3770 Intel 3.40ghz x4, PSU: 650 Watt, RAM: 8GB DDR3, OS: Win7 Ultimate 64-bit
PM
Northern
14
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 6th Jun 2014 11:04
@VRGames:

Hi,

Try io.read();

This statement will lock the script execution until you click on 'enter key'.

I hope this might help.

Cheers,

Northern
PM
VRGames
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: The Netherlands
Posted: 9th Jun 2014 22:38
Thanks for the help, I tried io.read(); but the script didn't stop, maybe I did something wrong.

Greetings
PM
tomjscott
User Banned
Posted: 9th Jun 2014 23:36
It would be useful to know what you are trying to accomplish. From what you are saying it sounds like you are trying to go about something the wrong way to begin with. You should probably be using the timer function and updating your variable each frame based on a delta time. Then you have total control of how something increments/decrements.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007
Northern
14
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 11th Jun 2014 05:34
@VRGames:

Sorry to know that the suggestion shown on my previous post (io.read()) it was not helpful.

Besides, Tomjscott he is right, because without knowing what you're trying to do with the Lua programming is harder for someone else here to know h
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 12th Jun 2014 23:53
I suspect it is to stop the player from being able to move until something has happened. A way to stop the player running off The start of Skyrim being one example I can think of. I've not seen a way to do this yet myself though. i could be wrong, but that is what I suspect is meant.



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
tomjscott
User Banned
Posted: 12th Jun 2014 23:57 Edited at: 12th Jun 2014 23:57
Quote: "I suspect it is to stop the player from being able to move until something has happened."




If that's the case then he's out of luck because just delaying in a loop isn't going to accomplish that. But for your issue, DVader, I know of a way you can do this at the start of the game if you want to know. You start the player in a spot that is surrounded by invisible walls. He won't be able to move, but he will be able to look around. Then you can destroy those walls after a set length of time or in response to pressing the E key at some point. As for doing it in other areas I suppose you could have invisible walls in certain places that spawn on a trigger and they would trap the player until you let him free to wander.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007

Login to post a reply

Server time is: 2024-12-22 05:54:35
Your offset time is: 2024-12-22 05:54:35