tpt.create but also set temp?

  • Potbelly
    23rd Sep 2017 Banned 0 Permalink
    This post is hidden because the user is banned
  • ChargedCreeper
    23rd Sep 2017 Member 0 Permalink

    You are using the legacy API I see. sim.partCreate returns an index which you can then modify. Here is an example. I did not test this but it should give you an idea on what I mean. elemHandle = sim.partCreate(-1, x+math.random(-1,1),y+math.random(-1,1),DEFAULT_PT_FIRE)
    sim.partProperty(elemHandle,'temp', 4724.15)

    I recommend doing it this way as it is very similar to how other proper APIs manipulate objects (i.e. the Win32 API)

    Edited once by ChargedCreeper. Last: 23rd Sep 2017
  • jacob1
    23rd Sep 2017 Developer 1 Permalink
    tpt.create should also return the index just like sim.partCreate does.

    There isn't a way to create a particle and set the properties at the same time. You just have to create it, and use the returned index to set the properties. Btw, these functions return -1 if it couldn't create a particle, you may want to check for that. There isn't an issue with "creating a local" for each ID, that's exactly what you are supposed to do.

    A function to create a particle and set properties would be nice though. There's a few "nice" things that could be added to the lua api
    Edited once by jacob1. Last: 23rd Sep 2017
  • ChargedCreeper
    23rd Sep 2017 Member 0 Permalink

    jacob1:

    tpt.create

     

    The API that is tpt.* is called the legacy which in my mind implies that is deprecated. Why do people still use it then?

    Edited once by ChargedCreeper. Last: 23rd Sep 2017
  • jacob1
    23rd Sep 2017 Developer 0 Permalink
    @ChargedCreeper (View Post)
    The functions do have shorter names, and many legacy scripts use them, which is probably why people continue to use it. There are several functions in the legacy api that aren't replicated in the newer api, but pretty much anything simulation related can be done with the sim. api.
  • Potbelly
    2nd Oct 2017 Banned 0 Permalink
    This post is hidden because the user is banned