I think I am learing how to script (Sort of the realy basics)
#3
(05-14-2011, 10:20 PM)Qwertygiy Wrote: Exactly. Here's some extra code bits to help you out, and a script that uses them:

while true do: This is a loop. It will repeat until instructed to "break".

[lua]
count = 0
while true do
sleep(1)
print("Looping.")
count = count + 1
if count > 10 then
break
end
end
[/lua]

It loops 10 times, printing "Looping" each time, then stops.

stuff:getChildren(): Gets a table with all the members being the descendents of stuff.

for q = 1, #table do: Loops through each member of table 'table'. q can be any letter. I use q because it's the first letter in the keyboard.

[lua]
local itemz = game.World:getChildren()
for q = 1, #itemz do
if itemz[q]:isA("Character") then
itemz[q].Body.Velocity = Vec2D(0,200)
end end
[/lua]

Makes everyone jump high Big Grin

Big Grin Thanks. I am also hosting a sever. http://buildism.net/game.php?id=4582 :3 Feel free to join.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)