For my perchance page I am stumped on a good way to approach a particular problem. Hoping I can get some advice.
https://perchance.org/treasurehoard
I have a list of ‘qualities’ an item might have, and each item gets three. But there are several rules which limit which items can get which qualities, so the items have conditionals like ^[c_type == 'ranged']
so I can set a variable and then have only the right things chosen. Similarly, one of the qualities should be enchanted, one mundane, and the third can be either, so there’s a variable for that, and so on. By using a consumable list, I also ensure the same quality never gets chosen twice for the same item.
So far, so good. But there’s one more rule to apply. Sometimes there is a mundane and an enchanted variant of the same quality, and a single item should never get both; for instance, a sword cannot be both Keen and Superior Keen. But nothing in the above precludes that.
I had tried to set up a system where the first quality picked got assigned to a variable c_q1 and then during the second quality being picked there would be a condition ^[c_q1 != 'Keen' && c_q1 != 'Superior Keen']
(and likewise with a c_q2) but no matter how I structured this, I always got caught in some infinite loop that I assume means I cannot count on things happening in strict left-to-right order. The page simply refuses to run and I occasionally get a “wait or end page” dialog, and I have to revert the change and save, then close and reopen the tab, to get out of it. Wracked my brain for hours last night on this before giving up and moving to the consumable-list option, even though it doesn’t address this particular quirk.
Can anyone suggest a smarter way to handle this?