Help please.

  • CCl2F2
    22nd Sep 2020 Moderator 0 Permalink

    Ok, recently I make a lot of TPT LUA scripts. I even tried with not LUA (Like C++, Compiling) but I failed. Nevermind.

     

    Last time I wrote METH (methane) script. Nothing special, just adds gas that has similar properties to GAS, but it's olive green. And I added some transitions, only with fire. I wonder is there a way to make transition where pressurized PLNT makes METH. Like "access" Basic TPT elements, change some of their properties. If I can do that easily (By script or so), tell me please. If not - guess what, ill just leave it in this form.

     

    Here is script:

    -- Functionally identical to restrict_flt() in source
    function restrict(f, min, max)
        if f < min then
            return min
        elseif f > max then
            return max
        end
        return f
    end
     
    elem.allocate("USSR", "METH")
    elem.element(elem.USSR_PT_METH, elem.element(elem.DEFAULT_PT_GAS))
    
    elem.property(elem.USSR_PT_METH, "Name", "METH")
    elem.property(elem.USSR_PT_METH, "Description", "Methane, biogas. Has good in power plants.")
    elem.property(elem.USSR_PT_METH, "Colour", 0x67940C)
    elem.property(elem.USSR_PT_METH, "MenuVisible", 1)
    elem.property(elem.USSR_PT_METH, "MenuSection", elem.SC_GAS)
     
    elem.property(elem.USSR_PT_METH, "Advection", 1.0)
    elem.property(elem.USSR_PT_METH, "AirDrag", 0.01)
    elem.property(elem.USSR_PT_METH, "AirLoss", 0.99)
    elem.property(elem.USSR_PT_METH, "Loss", 0.30)
    elem.property(elem.USSR_PT_METH, "Collision", -0.1)
    elem.property(elem.USSR_PT_METH, "Gravity", 0.0)
    elem.property(elem.USSR_PT_METH, "Diffusion", 0.5)
    elem.property(elem.USSR_PT_METH, "HotAir", 0.001)
     
    elem.property(elem.USSR_PT_METH, "Explosive", 150)
    elem.property(elem.USSR_PT_METH, "Flammable", 500)
    elem.property(elem.USSR_PT_METH, "Hardness", 2)
    elem.property(elem.USSR_PT_METH, "Meltable", 0)
    elem.property(elem.USSR_PT_METH, "Weight", 1)
     
    elem.property(elem.USSR_PT_METH, "HeatConduct", 30)
    elem.property(elem.USSR_PT_METH, "Temperature", 295.15)
     
    elem.property(elem.USSR_PT_METH, "Falldown", 0)
    elem.property(elem.USSR_PT_METH, "State", elem.ST_GAS)
    elem.property(elem.USSR_PT_METH, "Properties", elem.TYPE_GAS, elem.PROP_NEUTPENETRATE)
     
    elem.property(elem.USSR_PT_METH, "LowPressure", IPL)
    elem.property(elem.USSR_PT_METH, "LowPressureTransition", NT)
    elem.property(elem.USSR_PT_METH, "HighPressure", IPH)
    elem.property(elem.USSR_PT_METH, "HighPressureTransition", NT)
    elem.property(elem.USSR_PT_METH, "LowTemperature", ITL)
    elem.property(elem.USSR_PT_METH, "LowTemperatureTransition", NT)
    elem.property(elem.USSR_PT_METH, "HighTemperature", 523.15)
    elem.property(elem.USSR_PT_METH, "HighTemperatureTransition", DEFAULT_PT_FIRE)


    If you are good in TPT LUA system and have some free time, feel free to help me. Thanks.

    Edited 3 times by IlikeUssr. Last: 22nd Sep 2020
  • polokus
    28th Sep 2020 Member 0 Permalink
    elem.property(elem.DEFAULT_PT_PLNT, "HighPressure", 4)
    elem.property(elem.DEFAULT_PT_PLNT, "HighPressureTransition", USSR_PT_METH)
  • CCl2F2
    28th Sep 2020 Moderator 0 Permalink

    thanks.

     

    Edit: didn't work when i did that:

    print("Methane by IlikeUssr ")
    print("Changelog: ")
    print("Version 1.0 - Release ")
    print("Version 1.1(In dev.) - Now you can make METH from pressurized PLNT!")
    print("-------------------------------------------------------------------")
    print("Enjoy! ")
    -- Functionally identical to restrict_flt() in source
    function restrict(f, min, max)
    if f < min then
    return min
    elseif f > max then
    return max
    end
    return f
    end

    elem.allocate("USSR", "METH")
    elem.element(elem.USSR_PT_METH, elem.element(elem.DEFAULT_PT_GAS))

    elem.property(elem.USSR_PT_METH, "Name", "METH")
    elem.property(elem.USSR_PT_METH, "Description", "Methane, biogas. Has good use in power plants.")
    elem.property(elem.USSR_PT_METH, "Colour", 0x67940C)
    elem.property(elem.USSR_PT_METH, "MenuVisible", 1)
    elem.property(elem.USSR_PT_METH, "MenuSection", elem.SC_GAS)

    elem.property(elem.USSR_PT_METH, "Advection", 1.0)
    elem.property(elem.USSR_PT_METH, "AirDrag", 0.01)
    elem.property(elem.USSR_PT_METH, "AirLoss", 0.99)
    elem.property(elem.USSR_PT_METH, "Loss", 0.30)
    elem.property(elem.USSR_PT_METH, "Collision", -0.1)
    elem.property(elem.USSR_PT_METH, "Gravity", 0.0)
    elem.property(elem.USSR_PT_METH, "Diffusion", 0.5)
    elem.property(elem.USSR_PT_METH, "HotAir", 0.001)

    elem.property(elem.USSR_PT_METH, "Explosive", 150)
    elem.property(elem.USSR_PT_METH, "Flammable", 500)
    elem.property(elem.USSR_PT_METH, "Hardness", 2)
    elem.property(elem.USSR_PT_METH, "Meltable", 0)
    elem.property(elem.USSR_PT_METH, "Weight", 1)

    elem.property(elem.USSR_PT_METH, "HeatConduct", 30)
    elem.property(elem.USSR_PT_METH, "Temperature", 295.15)

    elem.property(elem.USSR_PT_METH, "Falldown", 0)
    elem.property(elem.USSR_PT_METH, "State", elem.ST_GAS)
    elem.property(elem.USSR_PT_METH, "Properties", elem.TYPE_GAS, elem.PROP_NEUTPENETRATE)

    elem.property(elem.USSR_PT_METH, "LowPressure", IPL)
    elem.property(elem.USSR_PT_METH, "LowPressureTransition", NT)
    elem.property(elem.USSR_PT_METH, "HighPressure", 2)
    elem.property(elem.USSR_PT_METH, "HighPressureTransition", NT)
    elem.property(elem.USSR_PT_METH, "LowTemperature", ITL)
    elem.property(elem.USSR_PT_METH, "LowTemperatureTransition", NT)
    elem.property(elem.USSR_PT_METH, "HighTemperature", 523.15)
    elem.property(elem.USSR_PT_METH, "HighTemperatureTransition", DEFAULT_PT_FIRE)
    elem.property(elem.DEFAULT_PT_PLNT, "HighPressure", 2)
    elem.property(elem.DEFAULT_PT_PLNT, "HighPressureTransition", NT)

     

    Can i fix it somehow?

    Also, i changed from 4 pres. to 2.

    Edited 2 times by IlikeUssr. Last: 29th Sep 2020
  • catchphrase911
    21st Jul 2021 Member 0 Permalink

    sorry for bothering you guys, but  i would very much like to learn how to make lua scripts for the powder toy, however i have no knowledge on coding whatsoever. if you could give me lessons or advice, that would be much appreciated! thanks.

  • accountdeleted
    21st Jul 2021 Member 0 Permalink

    @catchphrase911 (View Post)

     Yeah me too, I would also like to do that but I have no knowledge...