Jump to content




autodetect which sides has redstone connections


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

#1 moTechPlz

  • Members
  • 40 posts

Posted 14 April 2016 - 12:55 PM

Made a very simple program for computers to detect redstone input/outputs. Did a search with google but i couldn't find anything and the redstone api does not provide any and all the functions take a side string as input.

for _, sSide in pairs( redstone.getSides( ) ) do
  redstone.setOutput( sSide, true )
  redstone.setBundledOutput( sSide, 0xFFFF )
  sleep( 0.05 )
  if redstone.getInput( sSide ) then
	print( "detected redstone on " .. sSide )
  elseif redstone.getBundledInput( sSide ) ~= 0 then
	print( "detected bundled redstone on " .. sSide )
  end
  redstone.setOutput( sSide, false )
  redstone.setBundledOutput( sSide, 0x0 )
end

This function works because an output signal redirects to an input if the side has a redstone connection.

tested on CC 1.75 MC 1.7.10

Edited by moTechPlz, 14 April 2016 - 02:23 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users