[1.7.6 / Forbidden Cults] Occult Egress hidden RANDOM_ARTIFACT sequence causes infinite hang after first artifact
Posted: Tue Sep 22, 2026 9:21 pm
I've encountered a reproducible hang involving the three hidden RANDOM_ARTIFACT glyph sequences in the Occult Egress. My character is level 50, post-Far East, on Exploration mode with Forbidden Cults enabled. There are three RANDOM_ARTIFACT sequences generated for this save that I pulled from the save state. They are:
RANDOM_ARTIFACT1
Big Square -> Small Circle -> Small Square -> Big Triangle
RANDOM_ARTIFACT2
Small Lines -> Small Square -> Big Circle -> Big Triangle
RANDOM_ARTIFACT3
Big Circle -> Small Lines -> Small Circle -> Small Triangle
I tested this repeatedly from a backup save immediately before using any of these sequences. Whichever of the three sequences I enter first works normally and generates a Mirror Image Rune. After that, completing either of the other two valid RANDOM_ARTIFACT sequences causes ToME to hang immediately when the fourth/final glyph is changed into the correct configuration. I've reproduced it with the sequences in different orders. For example:
RANDOM_ARTIFACT1 -> Mirror Image Rune -> RANDOM_ARTIFACT2 -> hang
RANDOM_ARTIFACT2 -> Mirror Image Rune -> RANDOM_ARTIFACT1 -> hang
RANDOM_ARTIFACT3 -> Mirror Image Rune -> RANDOM_ARTIFACT2 -> hang
Saving, quitting, restarting ToME, and then attempting the second sequence still causes the hang, so the condition persists in the save. I looked through the Forbidden Cults source and found what appears to explain the hang in data/glyph_sequences/cults.lua:
tries is initialized to 100 and the loop checks tries > 0, but tries is never decremented. So, if game.zone:makeEntity() repeatedly returns nil because it can't find an eligible unique artifact, the loop never terminates because tries remains 100 indefinitely.
I also compared saves from immediately before and after the first successful RANDOM_ARTIFACT activation. The first activation adds Mirror Image Rune to the game's generated-unique registry. The subsequent activation then hangs as described above.
Additional observation regarding Mirror Image Rune
In every test from the same pre-glyph backup, the first RANDOM_ARTIFACT sequence produces Mirror Image Rune, regardless of which of the three RANDOM_ARTIFACT sequences I use first. This is consistent with the RANDOM_ARTIFACT sequences not having predetermined artifact rewards. The sequence handler instead calls:
The Occult Egress zone also sets both min_material_level and max_material_level to 5 once game.state:isAdvanced() is true. My character is level 50/post-Far East and has already generated a large number of fixed artifacts. My current suspicion is therefore that Mirror Image Rune may be the only remaining artifact eligible for this particular makeEntity() call in this save. The first RANDOM_ARTIFACT sequence finds it successfully. Once Mirror Image Rune has been generated and registered as a unique, a subsequent RANDOM_ARTIFACT sequence may have no eligible unique left for makeEntity() to return.
If makeEntity() then repeatedly returns nil, the missing decrement of tries in the RANDOM_ARTIFACT handler would cause the observed infinite loop.
I've confirmed by comparing the saves immediately before and after the first activation that Mirror Image Rune is the only new object added to the generated-unique registry. I have not yet confirmed that it was literally the only artifact eligible under makeEntity()'s filtering rules, so that part is only a hypothesis.
Reproduction from attached save:
The attached character is already inside the Occult Egress and has not interacted with the glyphs yet.
1. Load the attached character.
2. Enter any of the three RANDOM_ARTIFACT sequences listed above.
3. The first sequence should generate Mirror Image Rune.
4. Enter either of the other valid RANDOM_ARTIFACT sequences.
5. Upon changing the fourth glyph to complete the sequence, the game hangs.
I've attached a backup of the character save taken immediately after entering the Occult Egress, before interacting with any of the glyphs. This should allow the issue to be reproduced directly.
last_log.txt did not contain a traceback or other apparent error associated with the hang, which seems consistent with the suspected infinite loop.
The complete reproduction save is located here. Dropbox previews the ZIP contents in-browser, so use Download in the upper-right to download the complete archive.
Anyway. I spent long enough on this just because I wanted some free stuff.
RANDOM_ARTIFACT1
Big Square -> Small Circle -> Small Square -> Big Triangle
RANDOM_ARTIFACT2
Small Lines -> Small Square -> Big Circle -> Big Triangle
RANDOM_ARTIFACT3
Big Circle -> Small Lines -> Small Circle -> Small Triangle
I tested this repeatedly from a backup save immediately before using any of these sequences. Whichever of the three sequences I enter first works normally and generates a Mirror Image Rune. After that, completing either of the other two valid RANDOM_ARTIFACT sequences causes ToME to hang immediately when the fourth/final glyph is changed into the correct configuration. I've reproduced it with the sequences in different orders. For example:
RANDOM_ARTIFACT1 -> Mirror Image Rune -> RANDOM_ARTIFACT2 -> hang
RANDOM_ARTIFACT2 -> Mirror Image Rune -> RANDOM_ARTIFACT1 -> hang
RANDOM_ARTIFACT3 -> Mirror Image Rune -> RANDOM_ARTIFACT2 -> hang
Saving, quitting, restarting ToME, and then attempting the second sequence still causes the hang, so the condition persists in the save. I looked through the Forbidden Cults source and found what appears to explain the hang in data/glyph_sequences/cults.lua:
Code: Select all
for i = 1, 3 do
newSequenceEffect{ id = "RANDOM_ARTIFACT"..i,
message = _t"#PURPLE#An item appears on the egress!",
single_use = true,
trigger = function(portal, x, y)
local o, tries = nil, 100
while not o and tries > 0 do
o = game.zone:makeEntity(game.level, "object", {unique=true, not_properties={"lore"}}, nil, true)
if o then
game.zone:addEntity(game.level, o, "object", x, y)
break
end
end
end,
}
end
I also compared saves from immediately before and after the first successful RANDOM_ARTIFACT activation. The first activation adds Mirror Image Rune to the game's generated-unique registry. The subsequent activation then hangs as described above.
Additional observation regarding Mirror Image Rune
In every test from the same pre-glyph backup, the first RANDOM_ARTIFACT sequence produces Mirror Image Rune, regardless of which of the three RANDOM_ARTIFACT sequences I use first. This is consistent with the RANDOM_ARTIFACT sequences not having predetermined artifact rewards. The sequence handler instead calls:
Code: Select all
game.zone:makeEntity(game.level, "object",
{unique=true, not_properties={"lore"}}, nil, true)
If makeEntity() then repeatedly returns nil, the missing decrement of tries in the RANDOM_ARTIFACT handler would cause the observed infinite loop.
I've confirmed by comparing the saves immediately before and after the first activation that Mirror Image Rune is the only new object added to the generated-unique registry. I have not yet confirmed that it was literally the only artifact eligible under makeEntity()'s filtering rules, so that part is only a hypothesis.
Reproduction from attached save:
The attached character is already inside the Occult Egress and has not interacted with the glyphs yet.
1. Load the attached character.
2. Enter any of the three RANDOM_ARTIFACT sequences listed above.
3. The first sequence should generate Mirror Image Rune.
4. Enter either of the other valid RANDOM_ARTIFACT sequences.
5. Upon changing the fourth glyph to complete the sequence, the game hangs.
I've attached a backup of the character save taken immediately after entering the Occult Egress, before interacting with any of the glyphs. This should allow the issue to be reproduced directly.
last_log.txt did not contain a traceback or other apparent error associated with the hang, which seems consistent with the suspected infinite loop.
The complete reproduction save is located here. Dropbox previews the ZIP contents in-browser, so use Download in the upper-right to download the complete archive.
Anyway. I spent long enough on this just because I wanted some free stuff.