Script issue--idk whats wrong

  • S117
    29th Apr 2015 Member 0 Permalink

    Can i get some help?

     

    local element1 = elements.allocate("S117", "NGAS")
    elements.element(elements.NGAS_PT_S117, elements.element(elements.DEFAULT_PT_GASSES))
    elements.property(elements.NGAS_PT_S117, "Name", "ngas")
    elements.property(elements.NGAS_PT_S117, "Description", "New Gas")
    elements.property(elements.NGAS_PT_S117, "Colour",0xff0000 )
    elements.property(elements.NGAS_PT_S117, "MenuSection", elem.SC_gas)
    elements.property(elements.NGAS_PT_S117, "Gravity", 1)
    elements.property(elements.NGAS_PT_S117, "Flammable", 10)
    elements.property(elements.NGAS_PT_S117, "Explosive", 5)
    elements.property(elements.NGAS_PT_S117, "Loss", 1)
    elements.property(elements.NGAS_PT_S117, "AirLoss", 2)
    elements.property(elements.NGAS_PT_S117, "AirDrag", 1)
    elements.property(elements.NGAS_PT_S117, "Advection", 3)
    elements.property(elements.NGAS_PT_S117, "Weight", 20)
    elements.property(elements.NGAS_PT_S117, "Diffusion", 5)
    end

    Edited once by S117. Last: 29th Apr 2015
  • jacob1
    29th Apr 2015 Developer 0 Permalink
    Two main problems. DEFAULT_PT_GASSES isn't an element, were you trying to clone GAS? If so use DEFAULT_PT_GAS. If not, you have to use the identifier for whatever gas you are cloning (all identifiers are DEFAULT_PT_). The other problem is that you mixed up elements.NGAS_PT_S117. It should be elements.S117_PT_NGAS, your name goes first. I changed it to "element1" which is the proper way to do it but everyone uses the long way because Simon messed up the wiki example a really long time ago.

    local element1 = elements.allocate("S117", "NGAS")
    elements.element(element1, elements.element(elements.DEFAULT_PT_GAS))
    elements.property(element1, "Name", "NGAS")
    elements.property(element1, "Description", "New Gas")
    elements.property(element1, "Colour",0xff0000 )
    elements.property(element1, "MenuSection", elem.SC_GAS)
    elements.property(element1, "Gravity", 1)
    elements.property(element1, "Flammable", 10)
    elements.property(element1, "Explosive", 5)
    elements.property(element1, "Loss", 1)
    elements.property(element1, "AirLoss", 2)
    elements.property(element1, "AirDrag", 1)
    elements.property(element1, "Advection", 3)
    elements.property(element1, "Weight", 20)
    elements.property(element1, "Diffusion", 5)


    Edit: also elem.SC_gas should have been elem.SC_GAS. You need to capitalize things when needed :P.
    Edited once by jacob1. Last: 29th Apr 2015
  • S117
    29th Apr 2015 Member 0 Permalink

    Thank-you Jacob, i got mixxed up a little bit, its late and im a bit tired, lol.

    and im just used to using the long way. again, thank-you.