Complicated *if statement comes up with the wrong result

I’ve got a huge heap of “rumours” that the character can pursue as part of the game. In order to add a level of “gaminess” to it and preserve the illusion that the world is moving around outside of the player’s control, there’s a level of randomness to which rumours appear at any given time. You can reroll by performing other actions in the game.

Also, if a character is dead, their rumour will never show up.

If there are no new rumours, I want the game to explicitly tell the player this and send them back to another scene. And I also want the player to (separately) have the option not to pursue any of the rumours available to them.

In addition to this, most of the rumours are locked until you venture out beyond the starting area. Right now there are only two rumours you can pursue if you haven’t spent some time exploring the world. So I need to also reflect that: if the only rumours available are from places the character can’t access yet, it tells them there aren’t any new rumours.

Since there are fifteen god damn rumours, the code for doing all of this is kind of messy.

*if (randomrumours = false)
  *rand rumour_arcy 0 2
  *rand rumour_clooth 0 2
  *rand rumour_jolliant 0 2
  *rand rumour_molloth 0 2
  *rand rumour_nyeru 0 2
  *rand rumour_orrean 0 2
  *rand rumour_aursley 0 2
  *rand rumour_silk 0 2
  *rand rumour_mortulous 0 2
  *rand rumour_clankers 0 2
  *rand rumour_flrrrr 0 2
  *rand rumour_plucky 0 2
  *rand rumour_rigrenn 0 2
  *rand rumour_satiana 0 2
  *rand rumour_stalaxia 0 2
  *set randomrumours true

*if (dead_arcy = true)
  *set rumour_arcy 0
*if (dead_clooth = true)
  *set rumour_clooth 0
*if (dead_jolliant = true)
  *set rumour_jolliant 0
*if (dead_molloth = true)
  *set rumour_molloth 0
*if (dead_nyeru = true)
  *set rumour_nyeru 0
*if (dead_orrean = true)
  *set rumour_orrean 0
*if (dead_aursley = true)
  *set rumour_aursley 0
*if (dead_silk = true)
  *set rumour_silk 0
*if (dead_mortulous = true)
  *set rumour_mortulous 0
*if (dead_clankers = true)
  *set rumour_clankers 0
*if (dead_flrrrr = true)
  *set rumour_flrrrr 0
*if (dead_plucky = true)
  *set rumour_plucky 0
*if (dead_rigrenn = true)
  *set rumour_rigrenn 0
*if (dead_satiana = true)
  *set rumour_satiana 0
*if (dead_stalaxia = true)
  *set rumour_stalaxia 0

You search for rumours of other immortal beings in the world.
*if (((((((((((((((((rumour_arcy < 2) and (rumour_clooth < 2)) and (rumour_jolliant < 2)) and (rumour_molloth < 2)) and (rumour_nyeru < 2)) and (rumour_orrean < 2)) and (rumour_aursley < 2)) and (rumour_silk < 2)) and (rumour_mortulous < 2)) and (rumour_clankers < 2)) and (rumour_flrrrr < 2)) and (rumour_plucky < 2)) and (rumour_rigrenn < 2)) and (rumour_satiana < 2)) and (rumour_stalaxia < 2))) or ((exploring = false) and ((rumour_arcy < 2) and (rumour_clooth < 2))))
  Unfortunately, there aren't any new rumours.
  *goto_scene downtime

  *if (rumour_arcy = 2) # The small town of Trimpleton has lived in fear for centuries of a witch in the Tower of Rackenwort.
    *goto arcy
  *if (rumour_clooth = 2) # The fishing village of Smuthton has been blessed with suspicious quantities of oceanic trout.
    *goto clooth
  *if (exploring = true)
    *if (rumour_jolliant = 2) # An invincible colossal warrior has gone missing in Ochines.
      *goto jolliant
    *if (rumour_molloth = 2) # Yeseryth, the capital city of Ucrya, is up in arms about an underground demonic entity.
      *goto molloth
  # I'm not interested in these rumours.
    *goto_scene downtime

Unfortunately, I still get this:

I got it with dead_arcy = true and exploring = true.

Which isn’t what I want. It’s telling me that there aren’t any rumours available, but also at least one rumours is available. I’m not sure where the error is.

That’s a deep hole you’ve leaped into.


I think I found the problem, but just wanted to make sure.
How do you assume that at least one rumor is available?

What rumor do you think it is?
What is the “situations”? (is everyone else alive?)

It locks you out if every random roll is below 2, but if at least one is 2, it’ll show up in the rumour screen. What seems to be happening is that one result is 2, but it’s not showing up in the rumour screen. That’s my best guess at least.

Yes, all the others are false.

EDIT: I’m an idiot.

11 of them aren’t listed. There’s only four. So of course they’re not showing up in the rumour screen.

Wow Will, nice job. Really well thought out there. Brilliant.

-_- hurr durrrr

On the plus side, the code works fine if exploring = false because I’ve limited it to who actually shows up on the rumour screen right now. Duuuuhhhhrrrrr.


Hmm… So it’s established that arcy is dead, so [rumour_arcy] = 0. [exploring] also = true.
Thought for food.

Examining the logic of this command,

*if (((((((((((((((((rumour_arcy < 2) and (rumour_clooth < 2)) and (rumour_jolliant < 2)) and (rumour_molloth < 2)) and (rumour_nyeru < 2)) and (rumour_orrean < 2)) and (rumour_aursley < 2)) and (rumour_silk < 2)) and (rumour_mortulous < 2)) and (rumour_clankers < 2)) and (rumour_flrrrr < 2)) and (rumour_plucky < 2)) and (rumour_rigrenn < 2)) and (rumour_satiana < 2)) and (rumour_stalaxia < 2))) or ((exploring = false) and ((rumour_arcy < 2) and (rumour_clooth < 2))))

In this case, this actually will not give you

Unfortunately, there aren't any new rumours.

Because [exploring] = false, and [rumour_arcy] = 0.

The code always gives you FALSE based on your establishment.

So, yep. Nothing wrong with the code.
Indeed there’re no any new rumours.


Anyway, you can actually do this stuff to make your code looks easier on the eyes

*if a
   *if b
     *if c
1 Like

exploring = false and arcy < 2 and clooth < 2 actually gives me the right output! :wink:

Oh, right. Now I get it.

Dang, why would you drag me to hole with you, too?

1 Like

You can also do things like:

*temp cond1 (var1 and var2)
*temp cond2 (var3 and var4)
*if (cond1 and cond2)

In general, try to avoid large nests of braces, if you can. You’ll thank yourself in the long run!