Apologies if I seem realy dumb, I've never realy escaped from all preset functions all layed out ready for you. I'm trying to make a wait function, so if I typed wait(int number) it pauses for, well milliseconds ro seconds whichever, mine is VERY inefficient.
function wait(num)
num2=0
repeat
os.execute("errorcmd")
num2=num2+1
until num2==num
end
Any way of properly making it pause for a set amount of time without installing anything (I already have LOVE.)
pausing the script.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: pausing the script.
Wait sounds roblox-ish.Trappingnoobs wrote:Apologies if I seem realy dumb, I've never realy escaped from all preset functions all layed out ready for you. I'm trying to make a wait function, so if I typed wait(int number) it pauses for, well milliseconds ro seconds whichever, mine is VERY inefficient.
function wait(num)
num2=0
repeat
os.execute("errorcmd")
num2=num2+1
until num2==num
end
Any way of properly making it pause for a set amount of time without installing anything (I already have LOVE.)
http://love2d.org/wiki/love.timer.sleep
Hello, I am not dead.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: pausing the script.
That is not a very smart thing, zac. It would freeze the entire game for the entire duration of the sleep.
Trappingnoobs: a better way would be to do something like:
And in your love.update(dt):
Trappingnoobs: a better way would be to do something like:
Code: Select all
time_to_sleep = 1 -- one second
Code: Select all
if time_to_sleep > 0 then
time_to_sleep = time_to_sleep - dt
else
-- do your awesome things here
end
Help us help you: attach a .love.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: pausing the script.
It is exactly what the OP is asking for though, even if it isn't what you'd normally use in a game.Robin wrote:That is not a very smart thing, zac. It would freeze the entire game for the entire duration of the sleep.
- Trappingnoobs
- Citizen
- Posts: 95
- Joined: Tue Oct 12, 2010 8:52 pm
Re: pausing the script.
I'll do what Robin posted, thanks!
And zac, yes I learnt Lua from roblox, it's clearly a lot easier when it's all made for you XP
And zac, yes I learnt Lua from roblox, it's clearly a lot easier when it's all made for you XP
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: pausing the script.
Apologies to zac, I shouldn't have been so hard on you. I just think it's better to help people with what they need, not what they think they need.
Help us help you: attach a .love.
Who is online
Users browsing this forum: Amazon [Bot] and 60 guests