Jump to content


Desert_foxhole's Content

There have been 1 items by Desert_foxhole (Search limited from 22-October 19)


By content type

See this member's

Sort by                Order  

#227777 Elevator, need help

Posted by Desert_foxhole on 27 July 2015 - 01:02 AM in Ask a Pro

so i have an elevator that i made in tekkit (from technic launcher)

so far this is what i have :

while true do
function writee(tText)
local j = fs.open("base/elevator/stat","w")
  j.write(tText)
  j.close()
end
function scan()

peripheral.call("left","setBackgroundColor", "colors.blue")
peripheral.call("left","setCursorPos", "1,1")
peripheral.call("left","write"," LOBBY ")
peripheral.call("left","setCursorPos", "1,2")
peripheral.call("left","write","   UP   ")
peripheral.call("left","setCursorPos", "1,3")
peripheral.call("left","write","  DOWN  ")
peripheral.call("left","setCursorPos", "1,4")
peripheral.call("left","write"," GROUND ")
peripheral.call("left","setCursorPos", "1,5")
peripheral.call("left","write","		")
end
function blank()
peripheral.call("left","setBackgroundColor", "colors.red")
peripheral.call("left","setCursorPos", "1,1")
peripheral.call("left","write","	   ")
peripheral.call("left","setCursorPos", "1,2")
peripheral.call("left","write","	   ")
peripheral.call("left","setCursorPos", "1,3")
peripheral.call("left","write","	   ")
peripheral.call("left","setCursorPos", "1,4")
peripheral.call("left","write","	   ")
peripheral.call("left","setCursorPos", "1,5")
peripheral.call("left","write","	   ")
end
function wait()
while t == 0 do
  scan()
   local t = 0
   local event, side, xPos ,yPos = os.pullEvent("monitor_touch")
	if yPos == "1" then
	 writee("top")
	 peripheral.call("bottom","move",1,false,false)
	 t = 1
	end
	if yPos == "2" then
	 writee("up")
	 peripheral.call("bottom","move",1,false,false)
	 t = 1
	end
	if yPos == "3" then
	 writee("down")
	 peripheral.call("bottom","move",0,false,false)
	 t = 1
	end
	if yPos == "4" then
	 writee("bottom")
	 peripheral.call("bottom","move",0,false,false)
	 t = 1
	end
end  
end
function run()
blank()
local g = fs.open("base/elevator/stat","r")
  local h = fs.readAll()
   if h == "down" then
	peripheral.call("bottom","move",0,false,false)
   end
   if h == "up" then
	peripheral.call("bottom","move",1,false,false)
   end
   h.close()
end
function check()
local var1 = redstone.getInput("back")
local var2 = redstone.getInput("right")
  if var1 == true then
   wait()
  else
   if var2 == true then
	clean()
	wait()
   else
	run()
   end
  end
end
check()
end

the issue is that i have two peripherals that are connected to one computer(one monitor, and one carriage controller (id:1124:2)), so i used peripheral.call to call to the two peripherals the only problem is that it doesnt show or do anything, it starts up normally and doesnt throw any errors, is there something wrong with my code?

if you have any suggestions or modifications that NEED to be made to the code please post it with your comment, ive read too many comments that the user has to ask how the suggested code needs to be implemented