Are scripts functioning yet? - 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: Are scripts functioning yet? (/showthread.php?tid=1066) Pages:
1
2
|
Are scripts functioning yet? - Intile - 10-11-2010 If so, could I get just a couple of examples of something to get started on? From what I can gather, it looks like this'll be using Java instead of Lua, so I'll have to learn an entirely new language. haha. RE: Are scripts functioning yet? - Jacob__mybb_import1 - 10-11-2010 I use Lua for the scripting. You can type in the command bar, or use Edit>Insert Script to add a script, double click to edit it, then right click>Run Script to test it. Events don't work yet, but you can do a lot of simple things. Code: p = create("Box"); p. Size = Vec2D(10, 10); p.Position = game.Camera.Position; p.Parent = game.World Code: while true do game.World.Ground.Color = Color(math.random(0, 255), math.random(0, 255), math.random(0, 255)); sleep(1); end Code: step = 0.5 Code: game.TaskScheduler:schedule(function() --This makes sure the simulation won't step in the middle of the script RE: Are scripts functioning yet? - Intile - 10-11-2010 oh god thank you. I'm going to experiment around a bit more now that I know this. I'll post a bit later once I make something really silly. RE: Are scripts functioning yet? - ptown2 - 10-12-2010 oh goodie, now i can make waffle runners 2d mode RE: Are scripts functioning yet? - Jacob__mybb_import1 - 10-14-2010 Here is a simple script, used in the "Raining parts" game[/code]: Code: while true do RE: Are scripts functioning yet? - ptown2 - 10-14-2010 are there ways to make the script run when a player/object appears or dissapears? like the connection in RBLX LUA? RE: Are scripts functioning yet? - Jacob__mybb_import1 - 10-15-2010 Like an onChildAdded/onChildRemoved event? I just added events, so it should be pretty easy to do. RE: Are scripts functioning yet? - Jacob__mybb_import1 - 10-15-2010 The latest version has ChildAdded and ChildRemoved events. RE: Are scripts functioning yet? - Patacorow - 10-15-2010 sleep() is generally used to make the application go to "sleep", meaning, freezing it for a given amount of time (useful for game over screens or save & loads) Therefore, imo, it's kinda confusing. But I should stop whining and praise the fact you're a one man team. RE: Are scripts functioning yet? - Jacob__mybb_import1 - 10-15-2010 (10-15-2010, 05:04 AM)Patacorow Wrote: sleep() is generally used to make the application go to "sleep", meaning, freezing it for a given amount of time (useful for game over screens or save & loads) In Java sleep(time) means to wait a certain number of seconds, wait() means the current thread should wait until another thread notifies it to do something. Seems kind of backwards to me, but that's how it is... |