2DWorlds Forums
Ah, that stage in a script's progression... - 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: Ah, that stage in a script's progression... (/showthread.php?tid=5813)



Ah, that stage in a script's progression... - Phoenix - 06-14-2011

Where seeing it do absolutely anything would be a freaking miracle.
Debug, anyone?


Code:
enabled = true

link(script.Parent.Clicked, function(player, btn)
    if not enabled then return end
        enabled = false
        lazorcharges=50
        for i=1,lazorcharges do
            sleep(0.1)
            Charge = Instance.new("Box")
            Charge.Parent = game.World
            Charge.Position = Vec2D.new(math.random(340,342),math.random(19,21))
            Charge.Color = script.Parent.Color
            Charge.Size = Vec2D.new(0.1,0.1)
            Charge.Collidable = false
            Charge.CharacterCollidable = false
            Charge.Fixed = false
            Charge.Rotation = 0
            Charge.Velocity = Vec2D.new(0,0.5)
    firemylazor()
enabled = true
end
end)
  
function firemylazor()  
Matter = Instance.new("Box")
Matter.Parent = game.World
Matter.Position = Vec2D.new(math.random(340,342),math.random(19,21))
Matter.Color = script.Parent.Color
Charge.Size = Vec2D.new(0.1,0.1)
Charge.Collidable = false
Charge.CharacterCollidable = false
Charge.Fixed = false
Charge.Rotation = 0
Charge.Velocity = Vec2D.new(-20,0)
end

EDIT: Fixed one thing, code now is current, but still not working. t-t


RE: Ah, that stage in a script's progression... - Chaos - 06-15-2011

Maybe this should be in the scripters section...


RE: Ah, that stage in a script's progression... - Anti - 06-15-2011

Is it still broken, and if it is, what should it do in the first place? O_o' I dont want to start guessing what it should do...


RE: Ah, that stage in a script's progression... - Qwertygiy - 06-15-2011

Is it supposed to be in a tool, a box, what?


RE: Ah, that stage in a script's progression... - Phoenix - 06-15-2011

It's in a box which serves as a clickable button. It's supposed to cause red charges to appear at the position specified at random locations which float slowly upward.

After 50 of those charges are made, it's supposed to fire a large charge to the left at high speed.

Nothing happens when I click the button and no errors appear in output.


RE: Ah, that stage in a script's progression... - Phoenix - 06-15-2011

Edit: Got it to generate the boxes, the velocity is broken, though.

Code:
enabled = true

link(script.Parent.Clicked, function(player, btn)
    if not enabled then return end
        enabled = false
        lazorcharges=50
        for i=1,lazorcharges do
            sleep(0.1)
            Charge = create("Box")
            Charge.Parent = game.World
            Charge.Position = Vec2D(math.random(340,342),math.random(19,21))
            Charge.Color = script.Parent.Color
            Charge.Size = Vec2D(0.1,0.1)
            Charge.Collidable = false
            Charge.CharacterCollide = false
            Charge.Fixed = false
            Charge.Rotation = 0
            Charge.Velocity = Vec2D(0,50)
  
end
firemylazor()
enabled = true
end)
  
function firemylazor()  
Matter = create("Box")
Matter.Parent = game.World
Matter.Position = Vec2D(math.random(340,342),math.random(19,21))
Matter.Color = script.Parent.Color
Charge.Size = Vec2D(0.1,0.1)
Charge.Collidable = false
Charge.CharacterCollide = false
Charge.Fixed = false
Charge.Rotation = 0
Charge.Velocity = Vec2D(-200,0)
end