|
| 18 Sep 2013 03:39 PM |
function wait(n) local now = os.time() while os.time() - now < n do end print("achievement unlocked") end wait(1) |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:39 PM |
| :/ wait is a roblox API... |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:40 PM |
| Who said this was for roblox? |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:41 PM |
Youre missing an end And better put a wait () in the while loop |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:42 PM |
| good point..Just figured since it is on roblox forums... What is it for :3 I know roblox through to comptuercraft lua..To just plain. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:42 PM |
Youre missing an end And better put a wait () in the while loop ----------- Lies. |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:43 PM |
| Hmm..Either im losing myself, or i don't see where he is missing the end |
|
|
| Report Abuse |
|
|
| |
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:44 PM |
i think in other forms of lua..Its sleep(n)
so you could just do something like sleep(1) print("Achievment unlocked")
|
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:44 PM |
What is it for --------- A game I am working on outside of roblox. I am so used to doing wait via roblox lua that I decided to make a function for it.
|
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:44 PM |
| seeing how your using os, im guessing its for computer craft..Have you tried the computer craft help forums yet? |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:45 PM |
i think in other forms of lua..Its sleep(n) ----------- No. load.lua:8: attempt to call global 'sleep' (a nil value)
|
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:46 PM |
| Is it an already made game..Or are you litterly making a game out of lua? |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:46 PM |
seeing how your using os, im guessing its for computer craft..Have you tried the computer craft help forums yet? ----------- I do not even use computer craft. I also do not know what it is. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:48 PM |
Is it an already made game..Or are you litterly making a game out of lua? -- I am using lua for my games' logic. |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:49 PM |
i think:
function wait(n) local t = os.clock while os.clock - t <= n do end print("achievement unlocked") end |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
| |
|
tyele
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 320 |
|
|
| 18 Sep 2013 03:49 PM |
| Don't post it on Roblox if it's not for Roblox. This is for Lua, not anything else. |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
| |
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:51 PM |
well...
local clock = os.clock function wait(n) local t = clock() while clock() - t <= n do end print("achievement unlocked") end |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:51 PM |
Don't post it on Roblox if it's not for Roblox. This is for Lua, not anything else. --------- Please, tell me what scripting language roblox runs on? |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 03:52 PM |
local clock = os.clock function wait(n) local t = clock() while clock() - t <= n do end print("achievement unlocked") end ------------ That wouldn't work. You need to get the time as it stands therefore subtracting an older time value will just result in negatives indefinitely. |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 18 Sep 2013 03:57 PM |
hmm...
i kinda given up trying to help now so im just searching.. Something said Implement LuaSocket library and try this
socket.sleep(time) |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 04:00 PM |
| You do not understand my problem the code is perfect. The problem is that it goes over by .27 or under by .27. I want it to finish at exactly 1. |
|
|
| Report Abuse |
|
|