Difference between revisions of "Talk:Os.queueEvent"

From ComputerCraft Wiki
Jump to: navigation, search
m
Line 2: Line 2:
 
--[[User:Banane9|Banane9]] 15:21, 12 July 2012 (UTC)
 
--[[User:Banane9|Banane9]] 15:21, 12 July 2012 (UTC)
 
:It is supposed to output "Hello" when a redstone current from the left side comes or when the player hits Enter - which works for me --[[User:Pinkishu|Pinkishu]] 14:35, 13 July 2012 (CEST)
 
:It is supposed to output "Hello" when a redstone current from the left side comes or when the player hits Enter - which works for me --[[User:Pinkishu|Pinkishu]] 14:35, 13 July 2012 (CEST)
 +
:: if event == "redstone" then
 +
      if rs.getInput("left") then
 +
        os.queueEvent("key",28)
 +
      end
 +
    elseif event == "key" then
 +
      if param1 == 28 then
 +
        print("Hello")
 +
      end
 +
    end
 +
but the code says elseif, so i wonder why that would be executed when the event is redstone.

Revision as of 14:32, 13 July 2012

Is the Code supposed to not output hello when a redstone current comes? --Banane9 15:21, 12 July 2012 (UTC)

It is supposed to output "Hello" when a redstone current from the left side comes or when the player hits Enter - which works for me --Pinkishu 14:35, 13 July 2012 (CEST)
if event == "redstone" then
     if rs.getInput("left") then
       os.queueEvent("key",28)
     end
   elseif event == "key" then
     if param1 == 28 then
       print("Hello")
     end
   end

but the code says elseif, so i wonder why that would be executed when the event is redstone.