Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Silver

Simultaneous and tick based redstone outputs

Question

I am using something like this:

function pulse(rsComponent, side)
    rsComponent.setOutput(side, 15);
    rsComponent.setOutput(side, 0);
end

pulse(thirdGenerator, sides.bottom);
pulse(secondGenerator, sides.bottom);

Both "thirdGenerator" and "secondGenerator" are Redstone I/O block cpmponents connected to the computer via cables. 
Running this will make them give a short pulse at the bottom of the blocks but there is like a 10 tick delay between them.

How can I manage to make both of them activate at the same time?

Also, is there a way to set a fixed amount of ticks (a really short delay like 3 ticks or something like that) to wait between first and second pulse?

Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 1

Not sure if this will solve the delay between calls, but you can try using rs bundled cable and set the output simultaneously..

rsComponent.setBundledOutput(sides.back, colors.green, colors.red)

I don't think you can specify ticks for delay.. Only seconds and a tenth I believe...

Link to post
Share on other sites
  • 0
15 hours ago, Molinko said:

Not sure if this will solve the delay between calls, but you can try using rs bundled cable and set the output simultaneously..

rsComponent.setBundledOutput(sides.back, colors.green, colors.red)

I don't think you can specify ticks for delay.. Only seconds and a tenth I believe...

Too bad. I have ProjectRed but the bundled cable seems not to connect properly to the Computer / Redstone I/O blocks for some reason.

If there is no way of doing it with a computer I might stick to vanilla redstone then..

Link to post
Share on other sites
  • 0
7 hours ago, Gorzoid said:

OpenComputers is not the best for timed redstone due to the forced delay, I have to use computercraft when I want to do it.

That's unfortunate. It would be nice if there were any way to circumvent this delay in OpenComputers too..

Link to post
Share on other sites
  • 0

well if you want to have simultaneous outputs you need to set the redstoneDelay in the settings.conf to 0 (or less than a tick < 0.05) there is currently no other way to achieve that.

But be aware if you do so, you need to build a custom timing system into your script to avoid double calls on redstone in one tick otherwise you could end up with really bad MC performance.

I use something like this:

local redstone = require("component").redstone --lazy shorthand for demo purpose dont use that until you know why
local tick = computer.uptime() --get the current ingame uptime in seconds
tick = tick % 1 --gets only the fraction of a second
tick = tick * 20 --multiply by 20 to get the tick
tick = math.floor(tick + 0.1) --remove any binary error and get a clean tick number

-- you can shorten this to:
--local tick = math.floor((computer.uptime()%1)*20+0.1))

--create a shorthand that only executes if the set value differs
local function setRS(side, value)
  local current = redstone.getOutput(side) --get current output value, dont use getInput() could be different
  if current ~= value then
    redstone.setOutput(side,value)
  end
end

--you could also implement a execute only once per tick function to filter multiple calls in one tick
--but I dont do this since it would be stupid to change a redstone signal more than once in a tick anyway

Dafuq code block seems to have badly broken highlighter try with some real lua highlighter

Anyway I opened a issue on that on Github  to fix that by allowing to feed setOutput a table with six sides, maybe we are lucky and it get implemented.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.