This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
menof36go's profile picture

Yiedeling and Write Problems ...

Started by menof36go, 23 November 2012 - 02:47 AM
menof36go #1
Posted 23 November 2012 - 03:47 AM
Hello ,
i had the problem with yiedeling so i checked what's wrong . know i have an other problem , i dont know how to descripe
thats the code now there is now problem with yiedeling anymore but hmm ..


os.pullEvent = os.pullEventRaw
sleep(0)
local locker = true
local failed = true
local attempted_login = true
local password_server = 0
rednet.open("back")
rednet.open("left")
rednet.open("right")
sleep(0)
while locker do
sleep(0)
attempted_login = false
term.clear()
term.setCursorPos(1,1)
print("Welcome to a USERS PC : Roaming Profile Enabled")
print("What would you like to do?")
print("[1] Login (*)")
print("[2] Shutdown")
write("> ")
end
local input = read()
  sleep(0)
if input == "2" then
  sleep(0)
  os.shutdown()
  sleep(0)
elseif input == "1" then
  sleep(0)
  attempted_login = true
  print("Please login...")
  write("Username: ")
  local username = read()
  write("Password: ")
  local password = read("*")
  write("LevelPassword: ")
  local level = read("*")
  rednet.send(password_server, username, levelpassword, true)
  senderId, message, distance = rednet.receive(5)
   sleep(0)
  if password == message then
   sleep(0)
   print("Welcome ", username, " Level: ", level)
   print("[1] Doors")
   print("[2] Lights")
   print("[3] Attention")
   print("[4] Shutdown")
   write("> ")
   failed = false
   locker = false
   term.clear()
   term.setCursorPos(1,1)
   print("Welcome ", username)
  sleep(0)
  else
   print("Invalid Username or Password.")
   sleep(3)
  end
sleep(0)
else
  print("Command not recognised...")
  sleep(2)
end
  
   sleep(0)
   function LoginMenu()
   sleep(0)
   failed = false
   locker = false
   term.clear()
   term.setCursorPos(1,1)
  
   sleep(0)
   print("Welcome ", username, " Level: ", level)
   print("[1] Doors")
   print("[2] Lights")
   print("[3] Attention")
   print("[4] Shutdown")
   write("> ")
   end
  
   local input = read()
  
   sleep(0)  
   if input == "4" then
   sleep(0)
   os.shutdown()
   end
  
   sleep(0)  
   if input == "1" then
   sleep(0)
   shell.run("clear")
   sleep(0)
   print("Level1")
   print("Level2")
   print("Level3")
   print("Level4")
   print("Menu")
   write("> ")
   end
  
   sleep(0)
   if input == "3" then
   sleep(0)
   redstone.setBundledOutput("bottom", colors.white)
   print("If you not armed get the fuck out of here!")
   print("To deaktivate type in Stop")
   print("Or Type in LoginMenu to get back")
   write("> ")
   end
  
   sleep(0)
   if input == "2" then
   sleep(0)
   redstone.setBundledOutput("bottom", colors.orange)
   print("Lights on")
   print("To deaktivate type in Stop")
   print("Or Tpye in LoginMenu to get back")
   write("> ")
   end
  
   sleep(0)
   function Stop()
   sleep(0)
   print("Password")
   write("> ")
   sleep(0)
	 if input == 0815 then
	 sleep(0)
	 redstone.setBundledOutput("bottom", colors.lightBlue)
	 redstone.setBundledOutput("bottom", colors.magenta)
	 redstone.setBundledOutput("bottom", colors.red)
	 redstone.setBundledOutput("bottom", colors.blue)
	 redstone.setBundledOutput("bottom", colors.green)
	 redstone.setBundledOutput("bottom", colors.yellow)
	 redstone.setBundledOutput("bottom", colors.orange)
	 redstone.setBundledOutput("bottom", colors.white)
	 end
   end
  
   sleep(0)
   function Level1()
	 sleep(0)
	 if input == 0438 then
	 sleep(0)  
  redstone.setBundledOutput("bottom", colors.red)
	 end  
   end  
  
   sleep(0)
   function Level2()
	 sleep(0)  
  if input == 1795 then
	 redstone.setBundledOutput("bottom", colors.green)
	 end  
   end
  
   sleep(0)
   function Level3()
	 sleep(0)  
  if input == 1922 then
	 sleep(0)	
  redstone.setBundledOutput("bottom", colors.blue)
	 end
   end
  
   sleep(0)
   function Level4()
	 sleep(0)
  if input == 4431 then
	 sleep(0) 
  redstone.setBundledOutput("bottom", colors.yellow)
	 end
   end

hope you can help my =/
fabi
remiX #2
Posted 23 November 2012 - 04:36 AM
Could you at least try to describe it?

EDIT: Well from just glancing at your code, you have this in the beginning:

while locker do
    sleep(0)
    attempted_login = false
    term.clear()
    term.setCursorPos(1,1)
    print("Welcome to a USERS PC : Roaming Profile Enabled")
    print("What would you like to do?")
    print("[1] Login (*)")
    print("[2] Shutdown")
    write("> ")
end

This code will never stop, so when you start the program this will show and will never continue.
Lyqyd #3
Posted 23 November 2012 - 04:47 AM
So you had a problem with your code getting the "too long without yielding" error (it's YIELDing, not yiedeling or whatever), but you resolved that. So now you're asking for help with a problem you can't describe in code that's syntactically correct?