im just a noob that barely knows anything so idk enough about the Perchance script operators like the equals in the brackets u are using to know what they are doing, but i looked for what is different about the 6th moon and found if u change the number circled in red from 6 to 7 it makes your bug appear on moon 8 instead of 7. hope thats enough of a clue! lovely gen!
If you want to set a value of string to a variable, enclose them in quotations.
On line 176, you are doing [rank = apprentice, '']^[age == 6] however, apprentice as a variable doesn't exist. Which is why rank returns undefined when the age is 7. I would assume that it should be a string [rank = "apprentice", '']^[age == 6].
Then on debugging (Line 178), it should also be using strings e.g. [rank == "kit"]^[age <= 6][rank == "apprentice"]^[6 < age && age <=12]
check_for_uprank
[""]^0.000001 //Not foolproof, but just testing.
[rank = apprentice, ""]^[age=="6"]
You are setting the rank variable to an undefined value apprentice. But on the debug_error_1, you are setting the value to "apprentice" when age is 6.
Then if the age increased to greater than 7, the debug_error_1 would default to the first item since both items doesn't have odds. Which makes it that after 7, the rank would be kit again.
Lastly, on events_decider you are again comparing a variable to another variable, where it should be a variable and an absolute value like ^[rank == "kit"] not ^[rank == kit]