how to make element

  • jonasboz107
    15th Jun 2021 Member 1 Permalink

    i have copied and renamed elements in the file and the code but that hasnt worked cause none of them have shown up, i finally found ElementNumbers.h, the one that actually had all the numbers, tried making a new one for my new element, that completely broke it, i dont know what to do from here. PLEASE HELP ME IM DYING INSIDE

     

    also where i said "i have copied and renamed elements in the file and the code but that hasnt worked cause none of them have shown up" i mean thats what a video told me to do to make a new element but when i did it, it didnt work

    Edited once by jonasboz107. Last: 15th Jun 2021
  • TPTSortaGuy
    27th Jun 2021 Member 0 Permalink

    It is simple. You can do 2 things:

    1. Use the lua element creator(near top of page with a trash looking thing beside it)

    2. Make your own element.

    I can post the code. Here it is:

     

    elements.property(elements.AU3FGEN_PT_NAME, 'Name', 'NAME')
    elements.property(elements.AU3FGEN_PT_NAME, 'Description', 'Description here')
    elements.property(elements.AU3FGEN_PT_NAME, 'Color', '0x000000')
    elements.property(elements.AU3FGEN_PT_NAME, 'Menusection', '1')
    elements.property(elements.AU3FGEN_PT_NAME, 'Gravity', '1')
    elements.property(elements.AU3FGEN_PT_NAME, 'Flammable', '0')
    elements.property(elements.AU3FGEN_PT_NAME, 'Explosive', '0')
    elements.property(elements.AU3FGEN_PT_NAME, 'Loss', '0')
    elements.property(elements.AU3FGEN_PT_NAME, 'AirLoss', '1')
    elements.property(elements.AU3FGEN_PT_NAME, 'AirDrag', '0')
    elements.property(elements.AU3FGEN_PT_NAME, 'Advection', '1')
    elements.property(elements.AU3FGEN_PT_NAME, 'Weight', '25')
    elements.property(elements.AU3FGEN_PT_NAME, 'Diffusion', '0')
    local g = function(i, x, y, s, n)
    --Update Function
    end
    tpt.element_func(g, tpt.element('NAME'))
    local g = function(i, r, g, b)
    --Graphics Function
    end
    tpt.graphics_func(g, tpt.element('NAME'))

     

    Feel free to copy that code into a text editor. Do not copy this line though.

    Edited 2 times by TPTSortaGuy. Last: 27th Jun 2021
  • MyFuckingBals420
    4th May 2022 Member 0 Permalink

    Skidoo

  • ArolaunTech
    5th May 2022 Member 0 Permalink

    You were trying to add elements with C++, and that's hard. Lua is much easier. You can learn about how to code in Lua here: https://www.lua.org/pil/1.html.

     

    The wiki has a Lua API. It will allow you to use Lua to change things in TPT. Wiki tutorial here: https://powdertoy.co.uk/Wiki/W/Powder_Toy_Lua_API.html.

     

    If you are trying to do stuff with Lua, I highly recommend that you download the script manager: https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=19400.

     

    If you have it, then there will be a button on the side of your TPT screen, above the element categories, saying "Lua" on it. If you click it, you will see a window pop up. On the top right of the window is a button saying "Script Folder" on it. Clicking that button will take you to your scripts folder. Placing files in the script folder will let your script manager see them and let you run the Lua files.

  • xX_starfishprime_Xx
    13th Jun 2022 Member 0 Permalink

    am i allowed to make an element in console?