if-then-else

TPT Temporaryaccount-Decorator Script

Mar 4th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. --Hi, person reading source code! This script converts elements on screen to dmnd and decos it the approx color of the original element. This script is similar to Damian97s Rust Bomb Script. Note: Equave purposefully does something special.  
  2. local Dcor = elements.allocate("Temporaryaccount" , "DCOR")
  3. elements.element(Dcor, elements.element(elements.DEFAULT_PT_EMP))
  4. elements.property(Dcor, "Name" , "DCOR")
  5. elements.property(Dcor, "HeatConduct" , 0)
  6. elements.property(Dcor, "MenuSection", elem.SC_SPECIAL)
  7. elements.property(Dcor, "Description" , "Changes most elements into dmnd with the deco of the original element's color")
  8. elements.property(Dcor, "Color", "0xFFFE8EE0")
  9. local nnm = 0
  10.  
  11. function Decorate(i,x,y,s,n)
  12.     tpt.set_property('type', 'none', 'dcor')
  13.     local rx = 4
  14.     local ry = 4
  15.  
  16.     while ry < 380 do
  17.     local f = tpt.get_property("type", rx, ry)
  18.         if f ~= 0 then
  19.             if f ~= 116 then
  20.             local n = tpt.get_property("dcolour", rx, ry)
  21.                 if n == 0 then
  22.                     local r,g,b = gfx.getColors(elem.property(f, "Color"))
  23.                     tpt.set_property('dcolor', gfx.getHexColor(r,g,b,255), rx, ry)
  24.                 end
  25.             tpt.set_property('type', "DMND", rx, ry)
  26.             end
  27.         end
  28.         if f == 116 then
  29.             tpt.throw_error(" Haha trolololol... exit out the game to continue ctrl/command Q")
  30.         end
  31.         if rx == 607 then
  32.             rx = 0
  33.             ry = ry + 1
  34.             else
  35.             rx = rx + 1
  36.         end
  37.     end
  38.  
  39.     if nnm == 0 then
  40.         nnm = 75
  41.         tpt.register_step(Emp)
  42.     end
  43. end
  44.  
  45. function Emp()
  46.  
  47.     if nnm == 0 then
  48.         tpt.unregister_step(emp)
  49.         return
  50.     end
  51.  
  52.     a = math.random(0,255)
  53.     b = math.random(0,255)
  54.     c = math.random(0,255)
  55.  
  56.     gfx.fillRect(-1,-1, sim.XRES, sim.YRES, a, b, c, nnm)
  57.     nnm = nnm - 1
  58. end
  59.  
  60. tpt.element_func(Decorate,Dcor)
Advertisement
Add Comment
Please, Sign In to add comment