Advertisement
DayTimer

Layering helper

Jun 25th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.81 KB | None | 0 0
  1. --How to use: Choose "LAY" element from "tools" category; put it in any free place; type the number of layers you want;
  2. --Type element name, element ctype, element life, tmp and tmp2 and using spaces, commas or etc to split them.
  3. --Example: [number of layers]:[3]; [Particle 1]:[CONV METL 0 15]; [Particle 2]:[CONV SPRK 0 14]
  4. --This will create subframe sparker.
  5.  
  6. local layering = elements.allocate("ELEMENT", "LAY")
  7. elements.element(layering, elements.element(elements.DEFAULT_PT_DMND))
  8. elements.property(layering, "Name", "LAY")
  9. elements.property(layering, "Description", "Create layered elements. Use brush with size = 0")
  10. elements.property(layering, "Colour", 0x00AA00)
  11. elements.property(layering, "MenuSection", 13)
  12.  
  13. debounce = false
  14. local function update (i,xn,yn,s,nt) if debounce == false then
  15.     debounce = true
  16.     x,y = xn,yn
  17.     sim.partProperty(i,2,0)
  18.     layers = tonumber(tpt.input("Count","Type the number of layers, from 1 to 5"))
  19.     if type(layers) == "number" and layers>0 and layers<6 then
  20.         for i = 1,layers,1 do
  21.             particle = tpt.input("Particle "..i, "Enter: type, ctype, life, tmp, tmp2 with spaces")
  22.             count = 1
  23.             for type in string.gmatch(particle,"%w+") do
  24.                 if count == 1 then currentPart = sim.partCreate(-3, x, y, tpt.el[type].id) end
  25.                 if count == 2 then if type(tonumber(typed))=="nil" then sim.partProperty(currentPart, "ctype",tpt.el[typed].id)
  26.                 else sim.partProperty(currentPart, "ctype", typed) end end
  27.                 if count == 3 then sim.partProperty(currentPart, "life", type) end
  28.                 if count == 4 then sim.partProperty(currentPart, "tmp", type) end
  29.                 if count == 5 then sim.partProperty(currentPart, "tmp2", type) end
  30.                 count=count+1
  31.             end
  32.         end
  33.     else tpt.log("Error","Wrong input") end
  34.     sim.partKill(i)
  35.     debounce = false
  36. end end
  37. elements.property(layering, "Update", update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement