Annoying error

  • AlgoPowdo
    20th Sep 2021 Member 0 Permalink

    im trying to create a custom element but a error is stopping me : 

    = expected near )

    i added . and = but nothing

    i deleted line 5 but it keeps doing the error

    any way to fix this

  • _Theo
    20th Sep 2021 Member 0 Permalink

    what does the full thing look like

  • AlgoPowdo
    25th Sep 2021 Member 0 Permalink

    @TuDoR2007 (View Post)

     

    local ipa = elements.allocate("ISOPROPYL" , "ALCOHOL")
    elements.element(ipa, elements.element=elements.DEFAULT_PT_WATR)
    elements.property(ipa, "Name" , "IPA")
    elements.property(ipa, "Description" , "Isopropyl Alcohol. A cleaning product.")
    elements.property(ipa, "Property", TYPE_LIQUID+PROP_RADIOACTIVE)
    function CLEANING(i,x,y,s,n)
    if math.random(1,3) == 1 then
    tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'sltw')
    elseif math.random(1,3) == 2 then
    tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'dstw')
    elseif math.random(1,3) == 3 then
    tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'watr')
    end
    tpt.set_property("temp", math.huge, x, y)
    sim.pressure(x/4,y/4,math.huge)

    end

  • Hecker
    7th Aug 2022 Member 0 Permalink

    local ipa = elements.allocate("ISOPROPYL" , "ALCOHOL")
    elements.element(ipa, elements.element(elements.DEFAULT_PT_WATR))
    elements.property(ipa, "Name" , "IPA")
    elements.property(ipa, "Description" , "Isopropyl Alcohol. A cleaning product.")
    elements.property(ipa, "Properties", elem.TYPE_LIQUID+elem.PROP_RADIOACTIVE)
    function CLEANING(i,x,y,s,n)
    if math.random(1,3) == 1 then
    tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'SLTW')
    elseif math.random(1,3) == 2 then
    tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'DSTW')
    elseif math.random(1,3) == 3 then
    tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'WATR')
    end
    tpt.set_property("temp", math.huge, x, y)
    sim.pressure(x/4,y/4,math.huge)

    end




    here is the fixed code
    compare your code and see your mistakes and learn from them, 
    https://powdertoy.co.uk/Wiki/W/Element_Properties.html
    maybe this? https://powdertoy.co.uk/Wiki/W/Main_Page.html#Development_Guides

    Edited once by Hecker. Last: 7th Aug 2022