How do I create elements with console?

  • belugawhale
    24th Feb 2013 Member 0 Permalink

    The title says it all.

  • fireball5000
    24th Feb 2013 Member 0 Permalink

    !create (element name here) (coordinate X) (coordinate Y) :)

  • belugawhale
    24th Feb 2013 Member 0 Permalink

    I mean my own elements (like obsidian, gold, etc.)

  • fireball5000
    24th Feb 2013 Member 0 Permalink

    I don't think you can create elements from scratch using console, you have to learn C++. You can, however, modify current elements using TPT.EL commands.

  • jacob1
    24th Feb 2013 Developer 0 Permalink
    there is an element api, more info about it is in the wiki: https://powdertoy.co.uk/Wiki/W/Lua_API:Elements.html . It will allow you to create elements like this in lua scripts, which you can run with the console.

    several scripts use it (like MrSalit0s's lua mod) and you can look at more examples in actual use there, which may be easier than understanding the wiki.
  • belugawhale
    3rd Mar 2013 Member 0 Permalink

    I thought there was a tpt.el.bran.name="gold"

  • boxmein
    9th Mar 2013 Former Staff 0 Permalink
    @belugawhale (View Post)
    That does exist though... BRAN is a bad element to use for it.
    Also tpt.el.* will edit another element, with the new Element API you can create elements on the fly and NOT lose a vanilla element ever again!

    Also, shameful self promo:
    http://boxmein.web44.net/tptelements/
    OR
    http://boxmein.x10.mx/tptelements/
  • Oofy
    22nd Mar 2021 Member 0 Permalink

    idk maybe replace another one

  • ReallyJustDont
    29th Apr 2021 Member 0 Permalink

    Use elem.allocate. If using a LUA script with multiple lines (including ones run using the Script Paste mod), you can also store the resulting element ID in a variable to make it easier. 

     

    Example:

    local bees = elem.allocate("MODNAME", "BEES")

    (creates a new element stored in local variable "bees" and global variable "elem.MODNAME_PT_BEES")

     

    From there, you can assign properties such as the name, color, transitions and functions (more info here).

     

    Example (continuing from MODNAME_PT_BEES):

    elem.element(bees, elem.element(elem.DEFAULT_PT_DESL))

    elem.property(bees, "Name", "BEES")

    elem.property(bees, "Color", 0xFEFE0E)

    elem.property(bees, "MenuSection", elem.SC_NUCLEAR)

    (takes our previously made "BEES" element, makes it into a copy of DESL, and changes the color (to yellow), name (to BEES) and section (to Radioactive))

    Edited once by ReallyJustDont. Last: 29th Apr 2021
  • accountdeleted
    30th Apr 2021 Member 0 Permalink
    You can't.
    U can create elements writing a script or download scripts that other people made.