2DWorlds Forums
What is the command to "run" a script? - 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: What is the command to "run" a script? (/showthread.php?tid=4139)



What is the command to "run" a script? - AK-47 - 04-27-2011

I might just know how to fix my weapons...


RE: What is the command to "run" a script? - Qwertygiy - 04-27-2011

In game, or in build?

In build it's the little Lua symbol. In game you'd need a chatscript. I could make one if you needed.


RE: What is the command to "run" a script? - AK-47 - 04-28-2011

No, in a script, so you could run another script.

eg. :remove(), :clone(), :play()


RE: What is the command to "run" a script? - Qwertygiy - 04-28-2011

The Source of a script isn't locked in Buildism like it is in ROBLOX.

local s = create("Script")
s.Source = [[
line1
line2
line3
line4
]]

Try something like that. I'm having issues loading the editor right now, but you may want to check the Rocket script by Jacob_ in the default place. I know for certain that the main script creates a working other script.


RE: What is the command to "run" a script? - AK-47 - 04-28-2011

I already have those in my script. It won't run the scripts the create within a script.


RE: What is the command to "run" a script? - Anti - 04-29-2011

You need to change source of the created script before parenting it somewhere

a = create("Script")
a.Parent = game.World
a.Source = "print('lol')"

> Hello!


a = create("Script")
a.Source = "print('lol')"
a.Parent = game.World

> lol


EDIT:

And if you need to run existing script, just cut and paste it..

local Script = script.Parent.CutPasteScript
Script.Parent = nil
Script.Parent = script.Parent


RE: What is the command to "run" a script? - AK-47 - 04-29-2011

Oh crap. Thanks.


RE: What is the command to "run" a script? - Rare - 04-29-2011

Now, you fix it ^_^


RE: What is the command to "run" a script? - AK-47 - 04-30-2011

I had to fix it in notepad....