Rotor Machine Rule-Based Stepper
Write your own stepping rules, one line per wheel
- stepper
The preset stepper gives you Enigma or a car odometer and nothing else. This node gives you the machinery underneath: a tiny rule language where you say, per rotor, exactly which other rotors have to be on their notches for it to advance. If the pack has a node that rewards curiosity, it's this one - real machines had odd, idiosyncratic stepping, and this is where you can model it.
Output is stepper, a STEPPER for Rotor Machine State. Two inputs, both strings.
The rule language
rules is multiline, and there's exactly one rule per rotor - line one is slot 0 (leftmost), line two is slot 1, and so on. Three forms are legal on any line:
never- this rotor doesn't step on its own. Useful for reflector slots and for wheels you've wired as constants.always- this rotor steps on every keystroke.- a clause list of slot numbers, where
&means AND and|means OR.
A clause like 2 means "step when slot 2 is standing on one of its notches". 2&1 means both slot 2 and slot 1 have to be on notches. 2|1 means either. Chains of those work: 2&1|0 is OR of two clauses.
The default is the interesting one:
1
2|1
always
Read it as a three-rotor machine: the rightmost wheel (slot 2) steps every keystroke; slot 1 steps when slot 2 is on its notch or when slot 1 itself is on its notch; slot 0 steps when slot 1 is on its notch. That last extra clause on line two is the double-step, spelled out by hand. In other words, the default rules are the Enigma mechanism, written explicitly - which makes this node a decent way to learn what the preset is doing.
You can also use ; instead of newlines for separators, if you're generating the string from somewhere.
reverse: for machines that count down
reverse takes slot numbers, separated by spaces or commas, and those rotors step backwards on their rule instead of forward. Empty means everything steps forward, which is the normal case. So reverse: 1 makes slot 1 count down while the others count up - a nice way to build a puzzle mechanism that diverges instead of cycling in lockstep.
Validation is strict: a slot number outside 0..N-1 throws reverse slots out of range, and the rule count has to match the machine's rotor count exactly, so a three-line default on a four-rotor machine fails with Rules must have one entry per rotor. That includes the reflector slot when you're using a reflector rotor, and it includes any aux rotors. Slot numbers are absolute positions in the machine, not "the third one from the right" - reorder your rotor chain and every rule needs rewriting.
Installing it
Manager → ComfyUI ARG Toolkit → install → restart → refresh the browser. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
pip install -r requirements.txt
The node itself is a parser and a tuple; no models, no cryptography. The pack's requirements file pins torch, torchaudio, stegano and invisible-watermark anyway - the shared-install tax that every ComfyUI node pack levies on the same Python environment. Install once, on purpose, and take a note of what changed.
Debugging rules in practice
Nobody can hold a stepping rule in their head while looking at ciphertext. So don't try: wire the machine into Rotor Machine State Descriptor and read the slot table. It prints each rotor's rule in the same syntax you typed, plus the step direction, plus a note for any slot that never steps on its own - which is exactly the line you want to see when you've written a rule that accidentally converted a rotor into a paperweight.
Then test with repetition. Feed five identical letters through Rotor Machine Encrypt/Decrypt and read the output as a position trace: each distinct output letter is a different rotor state, and a repeating letter tells you the wheels came back around. If you expected slot 0 to move and every letter after the first looks like a two-rotor machine, your line one rule isn't firing - check the notch letters on the rotors it references, because a rule that says "step when slot 1 is on a notch" does nothing if slot 1's notches field is empty or wrong.
One last gotcha that bites in shared workflows: the default has three lines and expects three rotors. Half the "my rotor machine doesn't work" reports for this node are just someone building a four-rotor machine and leaving the rules at default.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| rules | STRING | 1 2|1 always | — |
| reverse | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| stepper | STEPPER | — |