How do I use tpt.register_step?

  • thunder999
    7th Jun 2011 Member 0 Permalink
    According to the wiki this should make it carry out a function every frame, but I can't make it do anything.
    I am trying to use it to run code that changes the temp of merc to 0 kelvin, I know the code for that is
    tpt.set_property("temp", 0, "merc)
    which works when I type it in, but
    tpt.register_step(tpt.set_property("temp", 0 "merc")
    does nothing.
    I assume I'm doing something wrong, so how do I actually do it?
  • MasterMind555
    7th Jun 2011 Member 0 Permalink
    @thunder999 (View Post)
    You forgot the second ")"

    If it doesn't work, maybe you don't have to say "tpt." inside the Parameter of the Function.
  • thunder999
    7th Jun 2011 Member 0 Permalink
    Added the ), still get an error, removed the tpt., still doesn't work. Thanks for pointing out the missing ). Got any more ideas?
  • The-Con
    7th Jun 2011 Member 0 Permalink
    I typed it in and it worked to an extent (not every frame, just a single frame). Remember the " when typing "0"
    and/or a "," after the 0
  • MasterMind555
    7th Jun 2011 Member 0 Permalink
    @thunder999 (View Post)

    The Wiki:

    Register a function to be run on every frame
    tpt.register_step(function func)


    Maybe tpt.register_step( function tpt.set_proprety("temp", 0, "merc") )

    @The-Con (View Post)
    Works without it
  • Simon
    7th Jun 2011 Administrator 0 Permalink

    function set_temp()
      tpt.set_proprety("temp", 0, "merc")
    end
    tpt.register_step(set_temp)
  • Anmol444
    7th Jun 2011 Member 0 Permalink
    !set temp merc 0

    With the exclamation mark.
  • thunder999
    7th Jun 2011 Member 0 Permalink

    Simon:


    function set_temp()
      tpt.set_proprety("temp", 0, "merc")
    end
    tpt.register_step(set_temp)

    I saved that as file.lua but when I type
    dofile("file.lua")
    in the console, powder toy crashes.
    @Anmol444 I already have the code for setting temp, I am trying to make it happen every frame automatically
  • jacksonmj
    7th Jun 2011 Developer 0 Permalink
    Typo in Simon's code:
    tpt.set_property("temp", 0, "merc")
  • edza101
    7th Jun 2011 Member 0 Permalink
    or !set temp merc 0