- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLoadProgramToTPT.lua
More file actions
Latest commit
37 lines (34 loc) · 924 Bytes
/
Copy pathLoadProgramToTPT.lua
File metadata and controls
37 lines (34 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--[[
Save this as synergy.lua or something in the same folder as TPT.exe
When you want to load the code, just open your computer save and write 'dofile("synergy.lua")'
Contents of hello.sc may look like this
110001101011101011100100100111
110001101110110110111101101110
110001111110100011101011110001
]]
localfilename=tpt.input("Load machine code","Enter *.sc filename (without extension)")
localcx,cy=145,106
locali=1
forclineinio.lines(filename..".sc") do
if#cline>5then
localcid=sim.partID(cx,cy)
sim.partProperty(cid,sim.FIELD_CTYPE,tonumber(cline,2))
cy=cy+1
ifcy==233then
cy=106
cx=cx+1
end
i=i+1
end
end
whilei<=889do
localcid=sim.partID(cx,cy)
sim.partProperty(cid,sim.FIELD_CTYPE,0)
cy=cy+1
ifcy==233then
cy=106
cx=cx+1
end
i=i+1
end
tpt.log(filename..".sc loaded.")