Urumasi

synergy.lua

Apr 3rd, 2015
525
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Save this as synergy.lua or something in the same folder as TPT.exe
  3. When you want to load the code, just open your computer save and write 'dofile("synergy.lua")'
  4. Contents of hello.sc may look like this
  5.  
  6. 110001101011101011100100100111
  7. 110001101110110110111101101110
  8. 110001111110100011101011110001
  9.  
  10. ]]
  11.  
  12. local filename=tpt.input("Load machine code","Enter *.sc filename (without extension)")
  13. local cx,cy=145,106
  14. local i = 1
  15. for cline in io.lines(filename..".sc") do
  16.     if #cline>5 then
  17.         local cid=sim.partID(cx,cy)
  18.         sim.partProperty(cid,sim.FIELD_CTYPE,tonumber(cline,2))
  19.         cy=cy+1
  20.         if cy==233 then
  21.             cy = 106
  22.             cx=cx+1
  23.         end
  24.         i=i+1
  25.     end
  26. end
  27. while i<=889 do
  28.     local cid=sim.partID(cx,cy)
  29.     sim.partProperty(cid,sim.FIELD_CTYPE,0)
  30.     cy=cy+1
  31.     if cy==233 then
  32.         cy = 106
  33.         cx=cx+1
  34.     end
  35.     i=i+1
  36. end
  37. tpt.log(filename..".sc loaded.")
RAW Paste Data