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

[1.3+]Redstone Gates API

Started by islanderon01, 12 April 2012 - 03:37 AM
islanderon01 #1
Posted 12 April 2012 - 05:37 AM
What's it do?

Lets you access redstone gates from a simple API.

Functions

Key: function, string, integer, boolean

spinner(interval, sleeptime): Outputs a redstone signal in a spinning fashion(i.e. front, wait, left, wait, etc.) Currently only spins clockwise.
- interval: How long to wait to turn to the next side after the current side is off.
- sleeptime: How long to keep each side on.

orGate(side1, side2, output): If either side1, or side2 is powered, the side output will output a redstone signal.
- side1(side): If this side has a redstone input, the side output will output a redstone signal.
- side2(side): If this side has a redstone input, the side output will output a redstone signal.
- output(side): The side to be powered if either side 1 or 2 is powered.

sendState(frequency, side, state): Using a rednet modem, sends a redstone state to the corresponding frequency.
- frequency: The frequency of which to send the state (Note: Never use the character ":" in your frequency.)
- side(side): The side of which the state is on.
- state: The redstone state of the corresponding side(i.e. true or false)

pulser(side, interval, amount): Pulses a redstone signal for a set amount of times on a set interval to the corresponding side.
- side(side): The side of which to pulse to.
- interval(seconds): Amount of time to wait between each pulse.
- amount: The amount of pulses to do.(Note: if no amount is set, it will continue until terminated.)

recState(frequency, set, timeout): Receive the a redstone state on the corresponding frequency.
- frequency: The frequency of which to listen on (Note: Never use the character ":" in your frequency.)
- set: if set to true, the function will automatically set the received state.
- timeout: The amount of time to wait for a state before ending (If none is stated, it will wait until a state is received)

Note: If you would like to manually send a redstone state, it is broadcasted to rednet like this: "RSW : frequency : side : state". The only thing not to replace is 'RSW', it tells the recState function that it's a redstone state message.

Todo List

- Fix notGate Function
- Add more gates (Suggestions are welcome)
- Cleanup Code ~ Done. Will be in next version.
- Your idea?

Download

pastebin, pastie
ETHANATOR360 #2
Posted 06 August 2012 - 09:53 PM
nice its like redpower built into computwer craft
http://www.minecraftwiki.net/wiki/Redstone_Circuits