lightning without LIGH!

  • peeps
    14th Nov 2011 Member 1 Permalink
    copy this script:

    function ligh()
    startx=tpt.mousex
    starty=tpt.mousey
    --tpt.create(startx , starty , "BRAY")
    raditus=math.random(1,100)
    angle=math.random(0,360)
    targetx=startx+(raditus*(math.cos(angle/2)))
    targety=starty+(raditus*(math.sin(angle/2)))
    tpt.create(targetx , targety , "BRAY")
    tpt.drawline(startx, starty, targetx, targety,255,0,0)

    for i=1, 2 , 1 do
    startx2=targetx
    starty2=targety
    --tpt.create(startx2 , starty2 , "BRAY")
    raditus2=math.random(1,50)
    angle2=math.random(0,360)
    targetx2=startx2+(raditus2*(math.cos(angle2/2)))
    targety2=starty2+(raditus2*(math.sin(angle2/2)))
    tpt.create(targetx2 , targety2 , "BRAY")
    tpt.drawline(startx2, starty2, targetx2, targety2,0,255,0)
    for i=1, 2 , 1 do
    startx2b=targetx2
    starty2b=targety2
    --tpt.create(startx2b , starty2b , "BRAY")
    raditus2b=math.random(1,50)
    angle2b=math.random(0,360)
    targetx2b=startx2b+(raditus2b*(math.cos(angle2b/2)))
    targety2b=starty2b+(raditus2b*(math.sin(angle2b/2)))
    tpt.create(targetx2b , targety2b , "BRAY")
    tpt.drawline(startx2b, starty2b, targetx2b, targety2b,0,0,255)
    end
    end
    end
    tpt.register_mouseclick(ligh)

    then save it as "ligh.lua" in the powder toy directory,then run the script,when you click the mouse,it will create lightning!(just line,and will also create BRAY points at all points which the lightning turns.)
  • taxi720
    14th Nov 2011 Member 0 Permalink
    But what is it used for?
  • me4502
    14th Nov 2011 Member 0 Permalink
    @peeps (View Post)

    i made the same thing in my mod... but i made an element for it... and it came out of clouds
  • electronic_steve
    3rd May 2014 Member 0 Permalink

    NICE! i like it. went to use.

  • Protcom
    3rd May 2014 Member 0 Permalink

    it said "console:1: attempt to index global 'ligh' (a nil value)" any idea ?

     

    EDIT : i tried to change the file name it said "cannot read stdin: bad file descreptor" any idea ?

    Edited once by Protcom. Last: 3rd May 2014
  • QuentinADay
    5th May 2014 Member 0 Permalink

    Really interesting!