Jump to content




[question][lua]


  • You cannot reply to this topic
20 replies to this topic

#21 Ghozer

  • New Members
  • 17 posts

Posted 07 July 2012 - 12:36 PM

View PostMysticT, on 05 July 2012 - 04:47 PM, said:

It doesn't really matter wich loop you use (altough while is normally used for infinite loops). The important thing is to have os.pullEvent("redstone"), since it will make the program just send the input when there's a change in redstone, so it doesn't loop all the time consuming you cpu time. If you want it to be able to stand on a pressure plate and have it send repeated key presses, then you should use a timer/sleep, like this:
local function pad()
  while true do
	-- check all the inputs
	sleep(0.5) -- you can change the time, so it checks more often
  end
end

I did actually have it like this once, had a 0.2 sec timer, because without it, or any lower it flooded the parallel api and caused it to error out...

I have it working nice now though! :P/>





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users