Need name change in Lua

  • Videogamer555
    14th Dec 2011 Member 0 Permalink
    Please add this feature
    For changing elements name you should be able to select the element and its new name like:
    tpt.el.metl.name="WXYZ"
    would make metal now appear in the menu as WXYZ.

    Now there are 2 ways of handling this. One possibility would be to have this change only the display string (but not the internal name of the element) so you could call 2 of these commands consecutively without compensating for the new name from the previous command, such as:
    tpt.el.metl.name="WXYZ"
    tpt.el.metl.name="ABCD"

    The other possibility is to have it change the entire name of the element so to call 2 consecutive commands would require compensating for the new name from the previous command like this:
    tpt.el.metl.name="WXYZ"
    tpt.el.wxyz.name="ABCD"

    I'll leave it up to the developers as to what they think would be the better of these 2 implementations, but I do think that some form of name change should be made.



    I also think that there should be a function to add new elements like this.
    tpt.newel(elementname, menusection)
    It will assign it the next available element index number.
    Then you can set the properties of that element via Lua commands like this:
    tpt.el.elementname.propertyname=propertyvalue
    tpt.eltransition.elementname.propertyname=propertyvalue



    And we also need to add some more eltransitions, namely:
    tpt.eltransition.elementname.whenburnedturnsto=
    and
    tpt.eltransition.elementname.whenlifereacheszeroturnsto=


    And properties for life should be.
    tpt.el.elementname.initiallife= (where default is 0)
    and
    tpt.el.elementname.lifelostperframe= (where 0 is default and no life is subtracted in each frame)

    And also to add a new menu would be cool like.

    tpt.newmenu(menuname, menuicon)
    menuicon would be the name of a BMP file located in the same folder as powder.exe and would be used as the icon fr the menu.



    This would allow people to make some new elements easily without spending one minute programing in C.
    They could basically make their own mods via Lua scripts. This would be awesome and would allow many people to make some of the realistic elements for realistic simulations that many people have wanted.
  • jacob1
    14th Dec 2011 Developer 0 Permalink
    Name changing is already in the next version. I'm not sure which implementation was used, I think what simon did kept the name the same in some arrays like the one you used, but when creating elements you have to use the new name. He will probably fix this and only use one way soon.

    Adding new elements would be usefull, but for now you can just replace wind or some of the old gol particles. I already created my liquid virus element in lua by replacing eqve, and you can also use wind, gnar, star, ... .
  • Videogamer555
    14th Dec 2011 Member 0 Permalink

    jacob1:

    Name changing is already in the next version. I'm not sure which implementation was used, I think what simon did kept the name the same in some arrays like the one you used, but when creating elements you have to use the new name. He will probably fix this and only use one way soon.

    Adding new elements would be usefull, but for now you can just replace wind or some of the old gol particles. I already created my liquid virus element in lua by replacing eqve, and you can also use wind, gnar, star, ... .


    Gnar and other GOL particles are not different elements. Instead they are all LIFE particles with different ctypes. Which means you have to replace all LIFE particle sub-types by changing the main LIFE particle type.

    Adding menus to put your altered elements in would be nice too, otherwise you risk forgetting where you left your altered elements.