[solved] converting topic to indexed text

So I have some conversation code:

[code]“convos” by Andrew Schultz

room 1 is a room. Biff is a man in room 1. 3-D is a man in room 1.

the block asking rule is not listed in any rulebook.

check asking about:
repeat through the table of biff-convo:
if the topic understood matches the topic entry:
if the speaker entry is noun:
say “[speaker entry] sez [statement entry][line break]” instead;
let L be a list of indexed text;
repeat through the table of biff-convo:
if speaker entry is the noun:
if there is an askable entry and the askable entry > 0:
add shorthand entry to L;
if number of entries in L is 0:
say “You don’t have anything specific to ask [noun] right now.” instead;
if number of entries in L is 1:
say “All you can ask [noun] about right now is [entry 1 of L].” instead;
say "[noun] won’t know anything about that. You can currently ask [noun] about ";
let count be 1;
repeat with LL running through L:
if count < number of entries in L - 1:
say "[LL], ";
otherwise if count is number of entries in L - 1:
say "[LL] ";
otherwise:
say “or [LL].”;
increment count;

table of biff-convo
topic speaker statement shorthand askable
“wxy/xyz” Biff “[one of]Xyz is xyz.[or]What else is there to say?[stopping]” “xyz” 1
“Biff/himself/him” Biff “[one of]I’m awesome.[or]You don’t deserve to hear how awesome I am yet.[stopping]” “Biff” 1
“hidden” Biff “You shouldn’t be able to ask about this!” “hidden” -1
“Biff” 3-D “Hey Biff! This kid doesn’t know who you are!” “Biff” 1[/code]

The “shorthand” entry in the table looks redundant. I’d like to be able to express the topic entry (a topic) as indexed text, and then cut off the first / and everything right of it.

unfortunately, I can’t get the second sentence straight…

Let I be indexed text. Let I be the topic understood as indexed text. replace the regular expression “/.*” in I with “”.

I know there are robust conversation packages out there that I’ll want to look at in the future–but they might take a while to implement/understand, and I had general questions about converting between indexed text and topics in addition to being able to clean up this table.

Thanks for any and all advice!

That would be just

let I be indexed text;
let I be the topic understood;
replace the regular expression "\/.*" in I with "".

You’ve already declared I as indexed text.
(I think phrases such as “the topic understood as indexed text” and the like are custom phrases only used by a couple of extensions that define them specially.)

Hmm. I didn’t know you could do that. Thanks very much!

But I think I phrased my question poorly. I didn’t realize you could call a column something, then put its type in parentheses. So I’ll try to pare things down to what I really want.

Currently the code works ok as such:

[code]“convos” by Andrew Schultz

The Diner is a room. Biff is a man in The Diner.

the block asking rule is not listed in any rulebook.

check asking about:
repeat through the table of biff-convo:
if topic understood matches the blather entry:
say “[statement entry]” instead;
say “Biff’s not very smart. Here’s all you can ask him about:[paragraph break]”;
repeat through the table of biff-convo:
say “-- [shorthand entry][line break]”;

table of biff-convo
blather (topic) statement shorthand
“Biff/himself/him” “[one of]I’m awesome.[or]You don’t deserve to hear how awesome I am yet.[stopping]” “Biff”
“McFly” “He should be writing my paper by now!” “McFly”
“Marty/Calvin” “That punk’s dead meat when I catch him!” “Calvin”
“Tree/trees” “Make like one and get out of here.” “Tree”

test askbiff with “ask biff about himself/ask biff about xyz”;
[/code]

But what I want to do is replace

		say "-- [shorthand entry][line break]";

With something more manageable, e.g.

let X be indexed text; let X be the regex manipulation of the coded text in the blather entry (replace "\/.*" with ""); say "-- [shorthand entry][line break]";

Is the 2nd line of the pseudocode manageable with some trick I don’t know yet? Or am I just not allowed to mix topic entries (as opposed to the topic understood) with indexed text?

I wouldn’t consider the shorthand redundant at all - that’s exactly how I’d do it. I used something like it in Gigantomania. Sometimes formatting and capitalization are hard to work out deterministically, and I wouldn’t consider it worth the trouble of indexed text.

Thanks! I appreciate just knowing that someone else figured it was expedient to do things this way.

I know I’ve had a lot of cases during my first few tries at coding where I thought I could do something similar. This looked like them, but if someone who knows what they’re doing says they didn’t bother, then…I’m not going to sweat it either.