Text Processor Flags. [Solved]

Seeker9043
31 Dec 2021, 21:11

Hello, I am trying to have the {if flag:text} and {if not flag:text} work in my game. While the {if not} works at first, it won't register any new changes (adding or removing flags) while the {if flag:text} doesn't work at all. I'm not sure what I am doing wrong as it seems like it is working yet at the same time it's not.


Seeker9043
02 Jan 2022, 05:59

Still trying thigs to make it work but nothing has changed, can't get the flag text to work and can't get the not flag text to not appear.


mrangel
02 Jan 2022, 09:51

How are you setting the flags?


Seeker9043
03 Jan 2022, 05:58

Let me get a game here to show you the weird behavior of this, give me a sec...
here it is:

https://textadventures.co.uk/games/view/naud8ziexukytqef7dfyta/test-game

Look at the wardrobe and see the four number in the box, like this:

  1. The wardrobe looks dirty

Considering the fact the code itself is not present that must mean Quest is registering it correctly, yet when you use the two Test Flags and Removers it does not change it one bit.
Here is the text with the code listed:

  1. {if not flag Polished:{if not flag Clean: The wardrobe looks dirty}}
  2. {if flag Polished: The wardrobe looks polished}
  3. {if flag Clean: The wardrobe looks clean}
  4. {if flag Polished:{if flag Clean: The wardrobe is both polished and clean}}
    Again I'm not what I'm doing wrong, considering that 1 is showing it properly that must mean with how one is set up then the others should follow yet they don't. I am using the Online version if that helps.

mrangel
03 Jan 2022, 11:34

OK, my first guess was right. Those flags are always false, because you don't have any code that sets them.

This code:

SetObjectFlagOn (Wardrobe, "Polished")

Sets a flag named Polished on the object Wardrobe.

This code:

{if not flag Polished:

Tests if there is a flag named flag Polished on the object game,

You want:

1. {if not Wardrobe.Polished:{if not Wardrobe.Clean: The wardrobe looks dirty}}
2. {if Wardrobe.Polished: The wardrobe looks polished}
3. {if Wardrobe.Clean: The wardrobe looks clean}
4. {if Wardrobe.Polished:{if Wardrobe.Clean: The wardrobe is both polished and clean}}

(I do agree that a flag name without an object specified should refer to the object currently being examined. However, the people who designed the text processor decided to make it use the special object game instead. This is one of the things I would like to tidy up if I'm in a position to work on a future update)


Seeker9043
03 Jan 2022, 15:31

OOOOOOOOOOOOOOOOOHHHHHHHHHHHH, it works now! Thank you!

Though why would Quest list the flag text command like that and not make reference that you need to set it up like how you're doing it. Here I thought it was buggy or something, which made me worried that I was going to have to spend a good two hours writing all of the different combinations for describing one object as it accumulates flags. Thank you again.


mrangel
03 Jan 2022, 16:39

I think it's probably because the flag functions were originally designed for the gamebook mode, where all flags are on the game object. The text processor code is the same for text adventures and gamebooks; so using game as the default applies to both. (It's not quite clear which object's flags a text adventure should use as the default… there are arguments that could be made for game, the player, or the current object… but for gamebooks game is the only one that makes sense, so the text processor uses that)