Need a little help scripting - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13) +--- Thread: Need a little help scripting (/showthread.php?tid=7500) Pages:
1
2
|
Need a little help scripting - Virtualdarks - 07-31-2011 Well, I'm fresh here from ROBLOX. I been a 3 year veteran there, and still playing it. The Lua conversion is getting me a little. Here's the script I wrote: while true do newboxo = create("Box") newboxo.Name = "newboxo" newboxo.Size = Vector3.new(3,3) newboxo.Parent = game.World newboxo.Position = script.Parent.Position newboxo.Fixed = false sleep(2) newboxo:remove() end What's suppose to happen is that a new "Box" appears at the position of the currently existing Box, then drop, then 2 seconds later, removes itself. If something in the script is obsolete in Buildism, please tell me. Yes I do know RBX.Lua. It's just much simpler in ROBLOX. RE: Need a little help scripting - Qwertygiy - 07-31-2011 Vec2D(x, y) not Vector3.new(x, y, z) Also, you might want to use [ lua ] tags around your code when you post it RE: Need a little help scripting - Virtualdarks - 07-31-2011 Oh, so it's Vec2D now? Thanks. And I'll keep the tag thing in mind. I'm too use to ROBLOX. RE: Need a little help scripting - Qwertygiy - 07-31-2011 I know; before Jacob_ started phasing out sleep() I regurlarly got it and wait() mixed up on BOTH sites. That and connect() and link(). RE: Need a little help scripting - Virtualdarks - 07-31-2011 Eh, the scripts are still going funky. ._. No dropping boxes. D: Nevermind! I just can't rewind anymore, that's all! RE: Need a little help scripting - Qwertygiy - 07-31-2011 Try this. [lua] function waitFor(time) local oldtime = os.time() while true do sleep(0.01) if os.time() - oldtime >= time then break end end end while true do newboxo = create("Box") newboxo.Name = "newboxo" newboxo.Size = Vec2D(3,3) newboxo.Parent = game.World newboxo.Position = script.Parent.Position newboxo.Fixed = false waitFor(2) newboxo:remove() end [/lua] As it says, sleep() for long periods will be disabled tommorrow. RE: Need a little help scripting - Virtualdarks - 08-01-2011 Thanks. Whenever I used "Sleep(1)", it spammed my chatbox with "Use os.time()" instead, even though I don't know what that is. RE: Need a little help scripting - Jacob__mybb_import1 - 08-01-2011 (07-31-2011, 11:59 PM)Qwertygiy Wrote: Try this. Only in events, not everywhere. RE: Need a little help scripting - Qwertygiy - 08-01-2011 It says that in the output whenever I use sleep. Including in loops and regular scripts. RE: Need a little help scripting - Jacob__mybb_import1 - 08-01-2011 (08-01-2011, 12:06 AM)Qwertygiy Wrote: It says that in the output whenever I use sleep. Including in loops and regular scripts. I know, but it will only be disabled in events, which is stated in the message. |