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

Simultaneous and tick based redstone outputs

Question

Posted

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?

7 answers to this question

Recommended Posts

  • 1
Posted

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...

  • 1
Posted

I believe the later version of oc has good support for enderio bundled cable. Also, I believe the delay between setting two colors at once is solved with bundled cable here. Just a thought :)

  • 0
Posted
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..

  • 0
Posted
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..

  • 0
Posted

Maybe you could do three outputs like this:

delet.PNG.44621cf48a07240e3fe293b1e43ea4fb.PNG

The one in the middle would fire both outputs at the same time, and you could still only fire one with the left and right ones.

 

  • 0
Posted

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.

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.