Help?

  • QuentinADay
    15th Jul 2014 Member 0 Permalink

    function some(i,x,y,s,n)
        type = tpt.get_property("ctype", x + math.random(-1,1), y + math.random(-1,1))
        if type == tpt.el.exot.id then
            tpt.set_property("tmp2", 99999, x + math.random(-3,3), y + math.random(-3,3))
        end
    end
    tpt.element_func(some,tpt.el.exot.id)

     

    Can somebody tell me why it says: "autorun.lua:2: Particle does not exist" after I place exot on screen?

  • FM22
    29th Jul 2014 Member 0 Permalink

    Most of the time, the 2nd line will ask for the ctype of a particle that is adjacent to the exot in question.
    When this happens, sometimes there will be no particle at that location and it will return an error.

    Fix:

    function some(i,x,y,s,n)
    local xo=math.random(-1,1) local yo=math.random(-1,1)
    if tpt.get_property("type", x + xo, y + yo) ~= 0
    if tpt.get_property("ctype", x + xo, y + yo) == tpt.el.exot.id then
    tpt.set_property("tmp2", 99999, x + math.random(-3,3), y + math.random(-3,3))
    end
    end
    end
    tpt.element_func(some,tpt.el.exot.id)

    Hope this works.

    Edit: Why can't I indent the code?

    Edited 2 times by FM22. Last: 29th Jul 2014
  • DemoManiac
    1st Aug 2014 Member 0 Permalink

    try replacting tpt.el.exot.id with DEFAULT_PT_EXOT

  • sfsjunior
    3rd Aug 2014 Member 0 Permalink

    Hello people! Sorry for using another people thread to post an question but i need to know how do i make an element be surrounded by other element (like shield when sparked).

    Thanks always!

    NOTE: i've tried using sim.partCreate but it have not worked

    Thanks again!

     

    ---Please don't ban me for this---

  • FeynmanLogomaker
    2nd Sep 2014 Member 0 Permalink
    @sfsjunior (View Post)
    Using sim.createParts(x, y, 1, 1, element type, 2) would be fastest, I think.