A nudge in the right direction

If somebody could point me in the right direction, I am trying to compare two different texts that have been inputted.

First, the randomly generated text of the name on an ID:

[code]

firstname is text that varies.
secondname is text that varies.

carry out giving photostrip to man:
remove photostrip from play;
choose a random row in the Table of Names;
now firstname is the First Name entry;
choose a random row in the Table of Names;
now secondname is the Last Name entry.

[\code]

Later on, the player requests that a check be written to someone of a specified name that the player types in (obviously, I have defined the checknaming action separately):

[code]

checkcasher is some text that varies.

carry out checknaming:
now checkcasher is the topic understood;
say “[line break]Check recipient: [checkcasher]”.

[\code]

The player, then needs to pick the check up at the bank. If the ID doesn’t match the name on the check, the teller should not dispense the check:

[code]

check giving id to teller:
if checkcasher is “[firstname] [lastname]”:
continue the action;
otherwise:
say “The cashier frowns. ‘I’m sorry, sir,’ the cashier says and hands the ID back to you. ‘Your name doesn’t match the one on the check.’” instead.

[\code]

If someone could point me in the direction of how to compare texts in this fashion, I’d appreciate it. I have also tried:

[code]

check giving id to teller:
if checkcasher matches “[firstname] [lastname]”:
continue the action;
otherwise:
say “The cashier frowns. ‘I’m sorry, sir,’ the cashier says and hands the ID back to you. ‘Your name doesn’t match the one on the check.’” instead.

[\code]

Thank you!

I’m not exactly sure what’s going on; from the following snippet of code, the first thing you wrote should work:

[code]Lab is a room.

Firstname is some text that varies. Firstname is “Umut”.
Lastname is some text that varies. Lastname is “Pamuk”.
Checkcasher is some text that varies. Checkcasher is “Umut Pamuk”.

When play begins:
if checkcasher is “[firstname] [lastname]”, say “First test passed.”;
if checkcasher is the substituted form of “[firstname] [lastname]”, say “Second test passed.”;
if checkcasher exactly matches the text “[firstname] [lastname]”, say “Third test passed.”[/code]

(All three tests are passed.)

One thing you might try is this:

if checkcasher exactly matches the text "[firstname] [lastname]", case insensitively:

in case the problem is with capitalization. (You might also have a problem if there are extra spaces between the names in checkcasher.)

By the way, you should put forward slashes / instead of backslashes \ when you’re closing a tag–that’s why your code tags aren’t displaying properly.

This will do the text comparison that you want:

if checkcasher exactly matches the text "[firstname in lower case] [lastname in lower case]":

One caveat is that it will require exactly one space between the first and last names in checkcasher. You can relax this constraint with regular expressions if you want. See §20.6.

Also, you’re using check and carry out rules, which are meant to check general preconditions and implement default behavior for actions, in specific cases (giving specific things to specific people) where before, instead or after rules would be a better choice. See §12.21.

(Looks like matt w beat me to it…)