Trigger loops, they are simple, memory efficient, only require two triggers, AND COST 500 MEMORY PER BLOCK IN EACH TRIGGER?!
There’s got to be another way…
1 block of code, The Trigger Loop:
A common Trigger Loop would usually require 1 Lifecycle, two wires, two triggers, and two sets of identical block code, one in each trigger. That would be:
50(Lifecycle)+80(Two triggers) +1000(Block code(1 in each trigger))+20(Two wires)
1150 Memory!
Hint: Don’t you think how the block code was used is inefficient…
Now, let’s take a look at a Wire Repeater Loop
A Wire Repeater Loop is similar to a Trigger Loop, it looks like this:
Your wire repeaters will “trigger” each other and the trigger with any set delay.
Here’s what the memory would look like
50(Lifecycle)+10(Two wire repeaters) +500(Block code)+50(5 wires)
Wow, that’s only 610 memory…we saved 540 memory!
Here’s an explanation on how that works given by @VALUEX
Read me!
Each trigger on usual costs 40 memory, however, if we add block code, it costs 40 + 500, which is 540 memory. Now in a trigger loop we can either use recursion and just use one trigger (not memory efficient as it would require 540 memory), or we can use two triggers and have 80 memory (40x, x=2, 40 * 2 = 80). Now that all is great, but we can not only simplify our lives, but also decrease memory consumption by 50%. You all will most definitely be asking, “HOWWW???”, well the answer is simple. Wire repeater loops. If you connect one wire repeater to another and have them interact with something, you would get:
10x + 5x = m
10x = 30, meaning x = 3, meaning 3 wires consuming 10g’s(a g, or a gim, is equal to 0.001% of memory, so 10 g’s are 0.01% of memory) of memory
5x = 10, meaning x = 2, meaning 2 wire repeaters consuming 10g’s of memory
30 + 10 = 40g’s of memory being consumed with this system(half of the trigger loop).
Incredible, right? Yes, it is, and though this system doesn’t allow channels or block code, we can add that using a trigger.
We can add two wire repeaters that form the loop, and a trigger that is triggered by the wire repeaters. We would then have block code or channels in that trigger in order to make the system more versatile.
For nerds:
10x + 5x + 40x + 500x = m
10x = 20g’s
5x = 5g’s
40x = 40g’s
500x = 500g’s
20 + 5 + 40 + 500 = 565g’s
Though that would mean that the trigger + wire repeater system consumes 15g’s less of of memory as the trigger loop system(when block code is applied to both), it works.
Key:
As a standard way to measure memory- g’s or gims- compared to bits, and 1000 gims = 1 kit, and 100 kits = 1 gimkit, 1 gimkit = 100,000 gims, or 100% of memory
Whenever you need a loop without consuming extra memory and that only needs wires, use the wire repeater system and save 50% (approximately, or possibly more) of memory!
But wait, you thought I was done there, HAH no. @Bardy_2913 reminded me of the single trigger loop. So, let’s check that out real quick.
Put a lifecycle down, when the game starts transmit on “game-start-trigger”. Now in the settings of the trigger you will put: When triggered transmit on “game-start-trigger”, and Trigger when receiving on “game-start-trigger” Make sure to put in a delay (ex, 1.0), and the trigger will trigger itself. The memory?
P.S No wires were used for this
50(Lifecycle)+40(Trigger)+500(block code)
590 Memory! Only 20 less than the Wire Repeater method.
If you remember our hint from earlier, you should now see how the first trigger version was inefficient
In the end, it may not seem like much, but every bit of memory counts
Credits: @ShadowDragon44 & @VALUEX & @Bardy_2913
Fun fact, with the setting below, there is no need for a counter to stop your trigger loop!
The Leaderboard
1 Block of code. Triggers vs Wire Repeater
A close race but the Trigger takes the dub
2 Blocks of code. Triggers vs Wire Repeater
IN PROGRESS
Guides on Wire Repeaters and Triggers
Wire Repeater Tutorial (and their useless brother, the repeater)!
On the Nature of a Trigger: A Deeper Study on its Biology and Role in Gimnature [WIP]