Whats wrong with this script

  • lemony118
    17th Mar 2012 Member 0 Permalink
    What's wrong with this script.
    I'm a beginner and I just want a hot element that makes neutrons when it comes into contact with
    water. Here's the script

  • Dawgie
    17th Mar 2012 Member 0 Permalink
    OK i fixed it (kinda) here it its it makes some neutrons when water is hit with fire
    -----------------------

        tpt.el.fire.name="BLFM"
        tpt.el.fire.description="So hot it turn water to neutrons"
        tpt.el.fire.color=0xC77400
        tpt.el.fire.weight=700
        tpt.el.fire.menusection=3
         math.randomseed(os.time())
        function growth(i,x,y,s,n)
        type=tpt.get_property("type",x+math.random(-1,1),y+math.random(-1,1))
        if type==tpt.el.watr.id then
        tpt.parts[i].type=tpt.el.neut.id
        end
        end
        
        tpt.element_func(growth,tpt.el.fire.id)

  • mniip
    17th Mar 2012 Developer 0 Permalink
    You damn broke the namespace, you may not define a variable called type. There is a such system function, and this script breaks the console
  • jenn4
    17th Mar 2012 Member 0 Permalink
    @mniip (View Post)
    Calm down, but really, type is restricted name in nearly every language.
  • Dawgie
    17th Mar 2012 Member 0 Permalink
    look i change one thing and thats not what it was and it works fine for me
  • lemony118
    17th Mar 2012 Member 0 Permalink
    TY for fixing it but 
    all I can see that you changed is that you got rid of the .temp=9999
    Anyway regarding reserved name spaces would this be any better???

    tpt.el.fire.name="BLFM"
        tpt.el.fire.description="So hot it turn water to neutrons"
        tpt.el.fire.color=0xC77400
        tpt.el.fire.weight=700
        tpt.el.fire.menusection=3
         math.randomseed(os.time())
        function growth(i,x,y,s,n)
        typeel=tpt.get_property("type",x+math.random(-1,1),y+math.random(-1,1))
        if typeel==tpt.el.watr.id then
        tpt.parts[i].type=tpt.el.neut.id
        end
        end
         
        tpt.element_func(growth,tpt.el.fire.id)
  • SkinnySatinTiger
    17th Mar 2012 Member 0 Permalink
    Edited once by SkinnySatinTiger. Last: 3rd Oct 2022
  • lemony118
    17th Mar 2012 Member 0 Permalink
    TY. Didn't think of that. I might make another lua script to make a NEUT with more velocity and higher temperature