Text variable matching question (includes regex)

@rockwalrus

I am finding the concept of relations super interesting and I can think of a bunch of clever ways to use that. I skimmed past that in the documentation not realizing the power to be had!

I noticed that ‘conflict’ is one-way.

I changed compatibility to be two-way and prevent self-self. I couldn’t work out how to make conflict two-way. Using one-way conflict to as a stepping stone to two-way compatibility is great and works just fine.

But I wondered if you had any thoughts about this:

[note, as defined, conflict is one-way]
Conflict relates various texts to various texts.
The verb to conflict with means the conflict relation.

[The following compiles but then the conflict relation fails]
[
 Conflict relates a text (called A) to a text (called B) when (A does not conflict with B) and (B does not conflict with A). 
Suit conflicts with Sneakers.  [<--- fails]
]

[ conflict detection in either direction and self same detection]
Compatibility relates a text (called A) to a text (called B) when (A does not conflict with B) and (B does not conflict with A) and (A is not B).
The verb to be compatible with means the compatibility relation.

Suit initially is "Suit".
Sneakers initially is "Sneakers".
Tie initially is "Tie".

Suit conflicts with Sneakers.

Test Room is a room.

When play begins:
	if Suit conflicts with Sneakers, say "Suit conflicts with Sneakers.";          [ true  ]
	if Sneakers conflicts with Suit, say "Sneakers conflicts with Suit.";          [ false ]
	if Suit conflicts with Suit, say "Suit conflicts with Suit.";                  [ false ]
	if Suit is compatible with Sneakers, say "Suit is compatible with Sneakers.";    [ false ]
	if Sneakers is compatible with Suit, say "Sneakers is compatible with Suit.";    [ false ]
	if Suit is compatible with Tie, say "Suit is compatible with Tie.";              [ true  ]
	if Tie is compatible with Suit, say "Tie is compatible with Suit.";              [ true  ]
	if Suit is compatible with Suit, say "Suit is compatible with Suit.";            [ false ]

(A is not B) crashes the interpreter, apparently under very specific and esoteric conditions. It took me hours to find out why my item description using a text replacement that refers to compatibility in multi condition while statements, crashed the interpreter - but the exact same text replacement works fine in other contexts. It’s only when it is used as one or more of multiple conditions for a while statement, and when that while statement is itself within a text replacement (To Say) and when that text replacement is invoked as part of examining an item’s description.

Use the same text replacement (same code, same while statement) for example, in "before examining , say “[MyText]”, no problem. Room description, other actions, works fine. Put that text replacement in the item’s description, interpreter crashes.

I guess I need a better way to do a text equality comparison. Strange that this provides correct outcome in nearly every way I have used it, but for that one really unique circumstance.

If you say Conflict relates texts to each other. then conflict will be a two-way relation and you should be able to simplify your definition of compatibility.

Did the interpreter say anything before crashing, such as error message?

Thanks. I finally saw that in the documentation. Slick. I’m currently playing with relationships based on what you pointed out, and the documentation. Really interesting stuff.

The interpreter just stops responding. Crash, hung, infinitely looping, I am not sure. In the story pane you can type text and hit enter which moves cursor to a new line, but the interpreter never responds. Click the “stop” button in the upper right corner is your only option.

I think it is whenever a while loop has multiple conditions and one or more of those conditions tests a relationship, and this gets executed as part of “saying” an item’s description. When that occurs, the carry out rule for examining that object seems to hang or crash. I decided it was more useful to just code around that situation than delve into it further.

Yeah, if the interpreter supports typeahead that could be an infinite loop.