Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Slotmachine my ecco7777 Copyright 2016
- chestside=2
- outputside=5
- --0 for down, 1 for up, 2 for -Z, 3 for +Z, 4 for -X and 5 for +X.
- money=0
- cost=1
- n1,n2,n3=1,2,3
- sym={"CC","IC","SC"}
- m=peripheral.wrap("top")
- s=peripheral.wrap("right")
- function show()
- m.clear()
- m.setCursorPos(1,1) m.write("Money:")
- m.setCursorPos(1,2) m.write(tostring(money).."$")
- m.setCursorPos(1,3) m.write("_Slots_")
- m.setCursorPos(1,4) m.write(sym[n1]..sym[n2]..sym[n3])
- m.setCursorPos(1,5) m.write("Play")
- end
- function play()
- if money>=cost then
- money=money-cost
- n1,n2,n3=math.random(1,3),math.random(1,3),math.random(1,3)
- value=tonumber(tostring(n1)..tostring(n2)..tostring(n3))
- if value==111 then s.extract(chestside,21256,outputside,1) end
- if value==222 then s.extract(chestside,30186,outputside,1) end
- if value==333 then s.extract(chestside,54024,outputside,1) end
- end
- end
- function payin()
- if id==21256 then money=money+(0.125*amount) end
- if id==30186 then money=money+(1*amount) end
- if id==54024 then money=money+(8*amount) end
- if id==86792 then money=money+(64*amount) end
- if id==119560 then money=money+(512*amount) end
- s.sort(chestside,amount)
- end
- show()
- while true do
- event,id,amount=os.pullEvent()
- if event=="isort_item" then payin() end
- if event=="monitor_touch" then play() end
- show()
- end
Add Comment
Please, Sign In to add comment