2DWorlds Forums
Can anyone convert from RBLX to Buildism? - 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: Can anyone convert from RBLX to Buildism? (/showthread.php?tid=1240)



Can anyone convert from RBLX to Buildism? - InternetGuy - 01-30-2011

Hoping someone can, I don't mind if you can't.
...
function onTouch(hit)
hit.Parent:kill()
end
script.Parent.Touched:connect(onTouch)


RE: Can anyone convert from RBLX to Buildism? - Jacob__mybb_import1 - 01-31-2011

function onCollide(part)
if part.Parent:isA("Character") then
part.Parent.Health = 0
end
end

link(script.Parent.Collided, onCollide)


RE: Can anyone convert from RBLX to Buildism? - guest - 01-31-2011

There :

Code:
function onTouch(part)
    if part.Parent:isA("Character") then
        part.Parent.Health = 0
    end
end

link(script.Parent.Collided, onTouch)



RE: Can anyone convert from RBLX to Buildism? - ____mybb_import1182 - 02-11-2011

I kind of like anonymous functions better

Code:
link(script.Parent.Collided,
function(p)
    print("Anonymous functions, for the win!")
    pcall(function()
        p.Parent.Health = 0
    end
end)



RE: Can anyone convert from RBLX to Buildism? - Jacob__mybb_import1 - 02-11-2011

You need the Parent:isA("Character"), otherwise your script will break if the part hits something that's not a character.


RE: Can anyone convert from RBLX to Buildism? - ____mybb_import1182 - 02-11-2011

(02-11-2011, 12:48 AM)Jacob_ Wrote: You need the Parent:isA("Character"), otherwise your script will break if the part hits something that's not a character.

Protected Call (PCall) can runs a function in a protected mode where it will catch any errors, if none, it runs the code. So basically, anything that 'breaks' defined in PCall's first arguement will not affect the scripts ability to run.


RE: Can anyone convert from RBLX to Buildism? - Qwertygiy - 02-11-2011

If anyone needs more help with converting Lua from ROBLOX to Buildism, go here: http://buildism.net/wiki/w/index.php?title=Converting_from_ROBLOX_Lua_to_Buildism_Lua