Question [Question] Help with userfrendly adjustable timer!

dustyfox

Terrarian
Hello everyone!!

I'm trying to build an adjustable timer. Below is a simple picture to illustrate basic idea:

original - Copy.png


The timer could be used for for:
- timed challanges
- timed messages e.g. "You have been playing for far too long!!" or "Your Coffee is ready (irl)" etc :D
- If start button is wired to daylight sensor, it could be used as alarm e.g. "It's 3:45 PM -> time to harvest some fireblossom!"
- and so on :)

However, I'm a bit at loss as to what should happen inside that back box in the picture above.. :D So if anyone here has some experience plz help! Any advice or commets are most welcome.

- Do you guys think this is possible to build?
- Estimation of the size? Hopefully it will not cover the whole map :D
- Any pointers to similar projects or good recources? (I was trying to google something like "logic gates and timer" or "Combinational Logic and Timers" but didn't get too far with that).
- maybe some examples?

Thanks a lot for reading :)
 
You could use a subtractive accumulator to create a countdown timer. Connect the ones bit of the accumulator to the timer. When the accumulator underflows, connect the carry to your output. To set the timer, you would have to insert the time directly into the byte. If you instead want to be able to count up as you flip the "set" switch, you would have to add an additive accumulator, which would make the device somewhat less compact. Alternatively, you could use an SR latch to toggle the accumulator between an additive and subtractive mode.
If you need help on how to make an accumulator, you could take a look at this tutorial thread that I made. If you're still confused as to how it works, I could create an example countdown timer for you.
 
Hey @Programmatic, thanks for the reply and link to tutorial!! I'll definitely check it out.

The explanation also helps a lot, as I now have correct terms for the logic constructs I need to build this thing 8) And I think the toggling between additive and subtractive mode sound's pretty appealing, but I guess I'll start with setting the time directory to the byte... It could actually be a lot handier then clicking the switch repeatedly :D

Also I don’t actually understand how to implement the memory byte just yet, but I guess I’ll learn that as read through your tutorials :)
 
So you want an alarm clock in Terraria? Setting up timers/clocks are pretty easy to do. You could simply chain a bunch of timers together to make a longer timer. That would be the simplest way if you are not good with logic gates.
60 Sec Timer_Normal_View.png
60 Sec Timer_Wire_View.png

I was playing around with making a counter for an idea I have that I plan to use in the future. When I looked at the S.D.M.G. in my inventory and saw in it's stats it said that the use time is "5 (Insanely Fast)". Then I thought, what does that mean? How fast is "5 use time" in "rounds per min"? I of course couldn't just count how many shots I lost after firing for a min because the S.D.M.G. has a "50% chance to not consume ammo". So then I decided I could use this counter to count the shots fired and wire it to a 60 sec timer chain that would start when the first shot hits the target, and disables the counter after 60 secs.
I haven't been able to test this yet, but I just thought it was a fun idea to try. `:D
 
Hi SovereignVis, thanks for your comment! I actually considered chaining timers, but decided agents it because the timer would then be hard to adjust and because I think learning to play with logic gates would be totally awesome! I mean if I could master this mysterious art then I could technically build anything, even a computer or something ;D However if I fail with the logic gates, this will be my backup plan :D

Btw the automatic bullet counting mechanism sounds like a really fun project! Love the ingenious idea :D

I actually checked the wiki on how terraria’s use time / firerate works and it seems like the formula for calculating rounds per second is 60(FPS)/useTime. This means that for Megasharks its 720 rounds per minute. I hope this info will not spoil the fun from making that project work in future… Cause it would still be really fun to see in action! 8)
 
Hi SovereignVis, thanks for your comment! I actually considered chaining timers, but decided agents it because the timer would then be hard to adjust and because I think learning to play with logic gates would be totally awesome! I mean if I could master this mysterious art then I could technically build anything, even a computer or something ;D However if I fail with the logic gates, this will be my backup plan :D

Btw the automatic bullet counting mechanism sounds like a really fun project! Love the ingenious idea :D

I actually checked the wiki on how terraria’s use time / firerate works and it seems like the formula for calculating rounds per second is 60(FPS)/useTime. This means that for Megasharks its 720 rounds per minute. I hope this info will not spoil the fun from making that project work in future… Cause it would still be really fun to see in action! 8)

Yeah, I looked up the use time and saw the math for it. But would still like to see if an accurate bullet counter would work in the game. Also some weapons are weird like the Clockwork Assault Rifle. It fires a 3 round burst. Does that mean because it's use time is 11 it's rate of fire is 327.2 or does the use time count each burst and not each shot fired? Because if it's use time is only counting the burst and it fires 3 rounds per burst then it's rate of fire is really 981.8. So I still think it's something worth testing. FOR SCIENCE!!! `;)
 
Hey guys thank you a lot for help! Here is the first version my timer :D
timer.gif

Its pretty much exactly what @Programmatic suggested and made with help of his tutorial thread :)

I really think its magical how the edge detectors suddenly learn to count in binary :D No matter how hard I try to understand, it's beyond me!

Now I just need to pretty it up... And maybe think of a better way to get that final output correctly! Right now i gotta toggle it like couple (or few more times) to make it trigger correctly at right time :D
 
Good job! There are a few other things that you could do to improve it.
First, to replace the AND gate at the top with a faulty lamp gate (with the switch connected to the logic lamp and the overflow carry connected to the faulty lamp), which will prevent the sign from being triggered sometimes when you turn the clock on.
Second, your accumulator only counts down at the moment. If you pass a wire through all of the logic lamps in the accumulator, you can reverse its direction to make it easier to set.
Third, the leftmost bit of your accumulator should be matching its respective torch (the opposite is true with additive accumulators). While it does not affect the timer in this case, keep that in mind when you use a subtractive accumulator in the future.
Finally, the rightmost bit isn't being affected by the timer in any way, since it's not connected to the green wire. You should just have the switch connected to the timer and the sign's gate lamp using the red wire, and connect the timer to the rightmost bit using the green wire.
 
Thank you so much for the improvement tips! I made a second version, and now with that accumulator-mode-flipping-switch, setting the timer is actually really user friendly! I was actually kind of frustrated with how difficult the first version was to set.. But hey, it worked somehow anyway, so I was real satisfied with it nonetheless ;)

Sadly I think I made some serious errors in this latest version...
version2_2.png

- when I'm setting the timer with A-switch the 5-second-timer goes on as well ;(
- and when I try to put the timer on with B-switch sign's logic lamp goes on and off with the 5 second timer, so the final output does not work sometimes ;(

I don't know why, but my brain just isn't working on how to overcome these problems.. :confused: Help would be appreciated.

(And by the way.. I forgot the blue wire that connected the sign to logic gate! :mad: But that's fixed now :cool:)
[doublepost=1493053694,1493052935][/doublepost]
So you want an alarm clock in Terraria? Setting up timers/clocks are pretty easy to do. You could simply chain a bunch of timers together to make a longer timer. That would be the simplest way if you are not good with logic gates.
View attachment 167039View attachment 167040
I was playing around with making a counter for an idea I have that I plan to use in the future. When I looked at the S.D.M.G. in my inventory and saw in it's stats it said that the use time is "5 (Insanely Fast)". Then I thought, what does that mean? How fast is "5 use time" in "rounds per min"? I of course couldn't just count how many shots I lost after firing for a min because the S.D.M.G. has a "50% chance to not consume ammo". So then I decided I could use this counter to count the shots fired and wire it to a 60 sec timer chain that would start when the first shot hits the target, and disables the counter after 60 secs.
I haven't been able to test this yet, but I just thought it was a fun idea to try. `:D
Hey @SovereignVis, did you also implement the counter? I can see the timer chain, but am I right, that the picture is missing the actual counter? :'D
 
Yes, the screen shot is only the timer chain part. The counter is 6 digits. More than what is needed to count a weapons rate of fire. `:D
 
Thank you so much for the improvement tips! I made a second version, and now with that accumulator-mode-flipping-switch, setting the timer is actually really user friendly! I was actually kind of frustrated with how difficult the first version was to set.. But hey, it worked somehow anyway, so I was real satisfied with it nonetheless ;)

Sadly I think I made some serious errors in this latest version...
View attachment 167573
- when I'm setting the timer with A-switch the 5-second-timer goes on as well ;(
- and when I try to put the timer on with B-switch sign's logic lamp goes on and off with the 5 second timer, so the final output does not work sometimes ;(

I don't know why, but my brain just isn't working on how to overcome these problems.. :confused: Help would be appreciated.

(And by the way.. I forgot the blue wire that connected the sign to logic gate! :mad: But that's fixed now :cool:)
[doublepost=1493053694,1493052935][/doublepost]
Hey @SovereignVis, did you also implement the counter? I can see the timer chain, but am I right, that the picture is missing the actual counter? :'D

To fix your first problem, connect your timer to a single-input OR gate, and connect the output of that gate to the 1s bit. That way, triggers will go from the timer to the 1s bit, but not the other way around.
To fix your second problem, do the same thing with an OR gate to connect the on switch to the timer, so that the timer's triggers don't affect the sign's lamp.
Finally, since you're only setting the timer when it's turned off, and the timer is only counting down when it's turned on, you could connect the additive / subtractive mode toggle directly to the on switch. Just make sure that it's in additive mode when the timer is off, and in subtractive mode when the timer is on. You can tell that it's in additive mode when the logic lamps are the opposite of their respective torches, and in subtractive mode when they are the same.
 
To fix your first problem, connect your timer to a single-input OR gate, and connect the output of that gate to the 1s bit. That way, triggers will go from the timer to the 1s bit, but not the other way around.
To fix your second problem, do the same thing with an OR gate to connect the on switch to the timer, so that the timer's triggers don't affect the sign's lamp.
Finally, since you're only setting the timer when it's turned off, and the timer is only counting down when it's turned on, you could connect the additive / subtractive mode toggle directly to the on switch. Just make sure that it's in additive mode when the timer is off, and in subtractive mode when the timer is on. You can tell that it's in additive mode when the logic lamps are the opposite of their respective torches, and in subtractive mode when they are the same.
Ah that's so easy and clever way of making one way connection! :D thanks a bunch! And that was a really great tip with flipping the accumulator mode with the switch! Now the timer has exactly same inputs as the ideal timer I was trying to build!!
[doublepost=1493062162,1493061932][/doublepost]
Yes, the screen shot is only the timer chain part. The counter is 6 digits. More than what is needed to count a weapons rate of fire. `:D

When you first posted the picture I didn't even notice the counter was missing, cuz there was just too much wire for me too follow :D
 
I actually just went back and looked at it. The screen shots were from a 4 digit counter. I had also made a 6 digit counter, but it actually can't fit in a screen shot. XD
Here is the 4 digit counter with the 60sec timer chain. I made it just a little shorter to fit in a screen shot.
4 Digit Counter with 60sec Timer_Normal View.png

4 Digit Counter with 60sec Timer_Wire View.png

I have also been thinking about making a clock just to display the time in the game and it would use day/night sensors. But I would need to set things up a little bit different because a clock doesn't just go up to 9 then back to 0 for all the digits.
 
Woah that quite a build! :eek: And you even had proper display for the counters! Real nice stuff @SovereignVis ;)
[doublepost=1493079590,1493077841][/doublepost]Alright, so here is the final product :cool:
- The timer can be set for over 5h (12 bits)
- Accuracy can be adjusted to 1, 3 or 5 seconds
- setting happens by repeatedly pressing the switch, (or you could go downstair to set it straight into the memory bits)
- The timer shuts down after its done (with a puff of smoke) :)

The result isn't all that flashy, but quite nice anyway ;)
Thanks for all your support! I could have never done anything without you :naughty:
 
It's not that big of a deal, it's just a simple counter that starts at 0 goes up to 9 then loops with each digit just adding to the next one. It's 1 thing just repeated 4 times, and there is a reset to set everything back to 0.
My Duck Hunt game was a much bigger wiring build. It had many parts connected to make one mini-game.
 
Back
Top Bottom