sim.partProperty help

  • Dawgie
    20th Jul 2013 Member 0 Permalink
    I am currently trying to recode an old script I made a while back and I am currently stuck tyring to use sim.partProperty to get the current temp of a particle to uses it in a comparison.



    sim.partProperty(elements.DAWGIE_PT_MGLQ, ("temp")) < 5000



    is an example of what I am using yet when I go to run the script I keep getting "attempt to compare nil with number" when I go to draw the particles. It always happens at first but eventually goes away. If you can help please do and if you need more of the script to attempt to help just ask. Thats just the line the error is on
  • Fast-Driver
    20th Jul 2013 Member 0 Permalink

    I have no idea if this will work because I don't normally use lua to code, but try using temperature instead of temp.

    Sorry, I don't know. :(

  • boxmein
    20th Jul 2013 Former Staff 0 Permalink
    @Dawgie (View Post)
    Do you declare the element before this other script?
  • mniip
    20th Jul 2013 Developer 0 Permalink
    @Dawgie (View Post)
    you don't specify which particle, and afaik partProperty is for an entirely different purpose
  • Dawgie
    20th Jul 2013 Member 0 Permalink
    @boxmein @mniip
    Thank you both I had at some point messed up where I was typing and really didn't notice

    edit:
    How would you get the temp of a certain particle then? It used to be tpt.get_property

  • jacob1
    20th Jul 2013 Developer 0 Permalink
    I suggest still using tpt.get_property because it's smaller to write and people understand it, and it's documented in the wiki how to use it, I would go look under the legacy lua api section. I'm not actually sure how to use partProperty but I think it involves weird things like sim.FIELD_TEMP

    If you want to get the temp of particle id i, do tpt.get_property("temp", i)
    If you want to get the temp of particle at location x,y, do tpt.get_property("temp", x, y)
  • Dawgie
    20th Jul 2013 Member 0 Permalink
    @jacob1 (View Post)
    Thanks I wasn't aware the old things still worked
  • jacob1
    20th Jul 2013 Developer 0 Permalink
    @Dawgie (View Post)
    Yeah, you don't need to rewrite everything using the sim api, the tpt api is still there and will never be removed.

    Some things in the sim api are nice though, but undocumented and/or not there til the next version AND undocumented.