Jump to content

Recommended Posts

Posted

Well, I've got a few constructs I'm trying to operate that require an automated redstone pulse. Thing is, the pulse required needs to repeat its self with an on time of about 30 seconds and an off time of about 2 minutes. The cycle time for both can be longer then this, but not shorter. Anyone have any ideas of how I could get something like this to operate automatically using what is available in tekkit?

Limitations are this though, Rednet controller can make a pulse that is 12 seconds long, no way long enough for this project. And I have no clue how to even use computer craft yet...

Any ideas out there on making something like this work? This is a survival game so I can't simply add the items in, I have to craft them.

Posted

I've done something similar, though it's been a while. What you need to do is use a RedNet controller and combine multiple functions. For example, create a square wave pulse with a period of 12 seconds (or 24 if it's 12-up 12-down) and then attach a counter to that. Finally, after a specific count you activate another pulse to turn on and perhaps yet another pulse to turn off. It depends on how particular you want to be.

So, vaguely to attempt to summarize:

(1) PRC function 1 -- square wave with max up/down timing

(2) PRC function 2 -- counter based on output from (1)

(3) PRC function 3 -- signal on based on output from (2)

(4) PRC function 4 -- if necessary, to signal off again; though you might be able to just have it cycle on/off with the same period based on function (3).

I'll go back to my setup and try to remember how it all works. :)

*******************************************************************

EDIT:

okay, here's more exact info on what I did:

(for maximum time extension, I used longest-period wave)

function 1

Wave (Square) [Timer]

Pd = CNST / 255

Q = VARS / 0

(then, attached a counter, outputting a signal to VARS 1 after 4 loops of above; you can configure that to whatever number of loops works for your timing)

function 2

Counter

INC = VARS / 0 (fires when receiving a signal from above (1))

DEC = CNST / 0

PRE = CNST / 4

Q = VARS / 1

V = NULL

(then, attached a pulse lengthener because I wanted it to stay on for a while; output went to VARS 2)

function 3

Pulse Lengthener

I = VARS / 1 (fires when receiving a signal from above, (2))

L = CNST / 255

O = VARS / 2

function 4

Input = VARS / 2 (fires when receiving a signal from above, (3))

do with it what you need to do... not sure what gate you're going to want

Posted

It will be quite convenient when we get a RedPower Logic replacement. The RedNet controller is really cool, but a lot of trouble sometimes. A good old timer is all ya need for simpler stuff.

Although, the code for ComputerCraft shouldn't be too hard.

Something like:

while true

redstone.setOutput("back",false)

os.sleep(100)

redstone.setOutput("back",true)

os.sleep(1)

end

Posted

I find computer craft a little bit easier to under stand. But with rednet you can have 16 channels, some day ill get around to learn it.

A simple code the repeats would look like this.

Type:

edit longpules (or what ever name you want it)

s = 1

repeat

rs.setOutput("back",true)

sleep (12)

rs.setOutput("back",false)

sleep (1)

until s == 0

BAM!

To save press (not hold) Ctrl and use the arrow keys and enter.

To run the file just type the file name.

You can set the out put to be any side. top, bottom, left, right, front and back.

The program will repeat forever unless

A: You leave the game

or

B: the sever shuts down

Once the program starts you cant control the computer... You can terminate its >.> mission by holding Ctrl and T

Posted

Oh, for the days of a State Cell hooked up to a Timer.

Ah well. You can probably do this with a classic redstone timer, but it'll eat up space easily.

Posted

I find computer craft a little bit easier to under stand. But with rednet you can have 16 channels, some day ill get around to learn it.

A simple code the repeats would look like this.

Type:

edit longpules (or what ever name you want it)

s = 1

repeat

rs.setOutput("back",true)

sleep (12)

rs.setOutput("back",false)

sleep (1)

until s == 0

BAM!

To save press (not hold) Ctrl and use the arrow keys and enter.

To run the file just type the file name.

You can set the out put to be any side. top, bottom, left, right, front and back.

The program will repeat forever unless

A: You leave the game

or

B: the sever shuts down

Once the program starts you cant control the computer... You can terminate its >.> mission by holding Ctrl and T

Just save the program as startup. It'll automatically resume when the computer reboots, right?

Posted

Yes you are right. I wright most of my programs on one computer and then copy them over to the computer that is used for what ever I need it to.

Posted

Well, I've got a few constructs I'm trying to operate that require an automated redstone pulse. Thing is, the pulse required needs to repeat its self with an on time of about 30 seconds and an off time of about 2 minutes. The cycle time for both can be longer then this, but not shorter. Anyone have any ideas of how I could get something like this to operate automatically using what is available in tekkit?

Limitations are this though, Rednet controller can make a pulse that is 12 seconds long, no way long enough for this project. And I have no clue how to even use computer craft yet...

Any ideas out there on making something like this work? This is a survival game so I can't simply add the items in, I have to craft them.

I have mostly played minecraft without mods so here is how I would do it.

I would set up a circuit of red-stone repeaters in a way that it takes 2 minutes and 30 seconds for a signal to come back around. Just put a red-stone torch down for a half a seconded to put a pulse into the red-stone loop. At the start of the circuit branch it off to activate a T-flipflop. Then at the point that the signal reaches after 30 seconds I would have it split again and deactivate the T-flip-flop so it is turned off again. 2:00 minutes later when the signal finishes the repeater loop it will turn the signal back on.

Posted

Yes, that's a good way to do it in vanilla. Thanks to mods, though, we can do it much more efficiently.

That depends what you mean be efficient. My way may take up more space but it would take far fewer materials to create and less expertise than a rednet controller.

  • Discord Moderator
Posted

Yes. something like this:

local outputSide = "back" -- or whatever: top, bottom, left, right, front, back

local onCycleTime = 30 -- how long to stay "on" in seconds

local offCycleType = 120 -- how long to stay "off" in seconds

local rednetColor = colors.white -- which color to cycle on the rednet cable. you can add like: colors.white+colors.red

 

local onTimer = os.startTimer(onCycleTime)

local offTimer = 0

redstone.setBundledOutput(outputSide, rednetColor) -- turn on the output at the start of the cycle

 

print "Press 'Q' to quit..."

while true do

  local event, p1 = os.pullEvent()

  if event == "key" and p1 == 16 then -- 'q' was pressed

      redstone.setBundledOutput(outputSide, 0) -- turn off if we "quit"

      return

  elseif event == "timer" and p1 == onTimer then

      redstone.setBundledOutput(outputSide, 0)

      offTimer = os.startTimer(offCycleTime)

  elseif event == "timer" and p1 == offTimer then

      redstone.setBundledOutput(outputSide, rednetColor)

      offTimer = os.startTimer(onCycleTime)

  end

end

I just whipped that up on the fly. Not tested so there might be something off, but that's the general idea.

Posted

sweet -- nice demo of how os.pullEvent() works. I still have a long way to go to really learn Lua.

Of course, I still like my PRC, but I know it's expensive...

  • Discord Moderator
Posted

This also demonstrates "named" timers. On such a simple program as this you don't strictly need them because the timers dont have to run concurrently. You could just change the code to toggle the rednet state and start a new timer based on that. However, when you have multiple different things going on (like updating a display and sensing an inventory) that happen at different intervals the named timers are imperative.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...