Detect Nearby Particles

  • Luezma
    24th May 2013 Member 0 Permalink

    Hi, I'm new on Lua Scripting but I learn very fast. I wanna know if there is a way to detect nearby particles, because I don't want to write a "Distance" code to, but if is the only way, just fine :)

  • jacob1
    24th May 2013 Developer 0 Permalink
    the wiki says there is a sim.partNeighbours function which returns a list of all the nearby particles. This is probably what you want. It's way better than that laggy distance code which makes every element slow. I think it returns the indexes of the particles.

    https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html <- first one

    There are a few functions not listed there, but they probably won't be needed anyway (since i'm not even sure what they do). That entire page just needs to be fixed to clarify it, and add the tons and tons of functions I just added for the next version.
  • Luezma
    24th May 2013 Member 0 Permalink

    Thx jacob1, I saw your posts, looks like that you're clever with TPT Lua ;)

  • mniip
    24th May 2013 Developer 0 Permalink
    @Luezma (View Post)
    D; what about meeeeeeee
  • xetalim
    24th May 2013 Member 0 Permalink

    @Luezma (View Post)

     Jacob1 is the "main" developer of TPT

     

    @mniip (View Post)

    you are a brony

  • mniip
    24th May 2013 Developer 3 Permalink
  • xetalim
    24th May 2013 Member 0 Permalink

    nvm you are pro

  • jenn4
    24th May 2013 Member 0 Permalink
    @mniip (View Post)
    That's just inefficient showing off. You should just print that text, instead of messing around with raw strings like that. Make something actually good if you want to show-off, not just something which's code looks fancy.
  • mniip
    24th May 2013 Developer 0 Permalink
    @jenn4 (View Post)
    this isn't raw strings actually, it uses next() to iterate over predefined tables like _G, it's heavily interpreter-dependent