Element Properties?

  • beskus
    13th Nov 2012 Member 0 Permalink

    Note: I am noob to the use of the powdertoy's Lua APIs.

     

    I recently started with creating my own elements in Lua. I try to understand them through studying mods, and I discovered element properties can be given with elements.property(). Untill I stumbled at this little piece of code:

     

            local Element4 = elements.allocate("MOD", "GOLD")
            elements.element(elements.MOD_PT_GOLD, elements.element(elements.DEFAULT_PT_METL))
            elements.property(elements.MOD_PT_GOLD, "Name", "GOLD")
            elements.property(elements.MOD_PT_GOLD, "Description", "Gold.")
            elements.property(elements.MOD_PT_GOLD, "Colour", 0xFFFE9E19)
            elements.property(elements.MOD_PT_GOLD, "MenuSection", 9)
            elements.property(elements.MOD_PT_GOLD, "Properties", 0x4024)

     

    What exacly does "Properties", 0x4024 do? And are there more strings I can use instead? And where can I find a list of all editable properties with elements.property? And how to use the list of properties on the wiki?

  • boxmein
    13th Nov 2012 Former Staff 0 Permalink
    @beskus (View Post)
    I'd suggest you bookmark the thread linked below. There are thorough guides to working with elTransition, properties and various tpt.el values.
    https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=14540
    https://powdertoy.co.uk/Discussions/Thread/View.html?Post=213607 -- tpt.el.X values
    https://powdertoy.co.uk/Discussions/Thread/View.html?Post=213705 -- Element transitions
    https://powdertoy.co.uk/Discussions/Thread/View.html?Post=213774 -- Element properties. (What you crave!)


  • beskus
    13th Nov 2012 Member 0 Permalink

    @boxmein (View Post)

    Thank you! this is really helpfull. I bookmarked the pages (as you adviced) so I can investigate them later.

     

    edit: Can you combine property values that are on the same place? like PROP_DEADLY (0x00400) and PROP_HOT_GLOW (0x00800)?

  • jacob1
    13th Nov 2012 Developer 0 Permalink
    @beskus (View Post)
    yes, you can. In hex, 8+4=C. If you combined all 4 properties in the same place, you would get F.

    You should actually find the properties here, and somehow use the official names instead of hex numbers. Eventually, all those links boxmein posted should be put into the wiki...
  • beskus
    13th Nov 2012 Member 0 Permalink

    @jacob1 (View Post)

    Can you give me an example of assigning the prop IDs from the wiki? so far it only worked with hex for me.

     


    edit: It did not work for me, only the value from the script I found did, but I wanted to ajust that.

  • jacob1
    13th Nov 2012 Developer 1 Permalink
    @beskus (View Post)
    elements.property(elements.MOD_PT_GOLD, "Properties", elements.PROP_DEADLY+elements.PROP_HOT_GLOW) seemed to work for me, just change the properties to the ones you want now.
  • beskus
    13th Nov 2012 Member 0 Permalink

    @jacob1 (View Post)

    It did! I used quotes at the prop (stupid  I know...) but it works now. Thank you very much!

  • mrsalit0s
    14th Nov 2012 Member 0 Permalink

    @jacob1 (View Post)

    didn't know that this works too, but it's much longer than using HEX values. however, it's advantageous that you can directly see what properties you're currently using.

     

    @beskus (View Post)

    if you want i could explain you some things.

  • MeltedGamezz
    21st January Member 0 Permalink

         

    @beskus (View Post)

     

    Instead of assigning the element  an id and using GROUP_PT_ELEMENT, you can use the variable that you assigned, which in your case is Element4

     

     

     

    Also, Instead of using elem.property for every property line, you can use an array, as shown below:

     

              elem.element(elementName, {

                           Name = "ELEM",

                           Description = "Custom Element",

                            etc... 

    Edited 5 times by MeltedGamezz. Last: 21st January