Working with table entries

I want to access an entry in a table, but I keep getting an error for wrong type?!
The entry is a key to tell me what action to call, that is, displaying further information.

[code]
Table of Emporium Goods
Topic Answer
“outfitting/adventuring” “[description of job posting]”
“weapons” or “arms” “weaponsTbl”
“armor” “armorTbl”
“equipment” “equipTbl”
“buying/selling” “[description of buysell_answer]”
“expeditions/sponsoring” “[description of exped_answer]”
“appraisals” or “gem appraisals” “[description of appr_answer]”
“banking” “[description of banking_answer]”
“accounts” or “a private account” “[description of accounts_answer]”
“loans” “[description of loan_answer]”

[Actions for providing buy/sell lists.]
Instead of asking Ganon about a topic listed in the Table of Emporium Goods in Ganon’s Emporium:
say “[answer_entry]”;
[ if [answer_entry] is:
– “armorTbl”: display armor table;
– “equipTbl”: display equipment table;
– “weaponsTbl”: display weapons table;
– otherwise:
say “Not my business.”;
]
The commented code is because I can’t even get past the say statement. I have tried the says statement with and without the quotes and brackets. Surely I can treat a table entry as text?
The error I get is (edited):
Problem. In the line 'say “[answer_entry]”, I was expecting that ‘answer_entry’ would be something to ‘say’, but it didn’t look like any form of ‘say’ that I know. So I tried to read ‘answer_entry’ as a value of some kind (because it’s legal to say values), but couldn’t make sense of it that way either.

Inform is confused because nowhere in your code do you tell it what answer_entry of supposed to mean.

I can’t check this compiles since I’m responding from my phone, but just before that, you need a line to the effect of:

Let answer_entry be the answer corresponding to a topic of the topic understood in the table of emporium goods:
2 Likes

Whew! That’s a mouthful! Thanks. I’ll give that try.

I got parser errors on that line. However, before I worried about that, I noticed that I had an underscore where it shouldn’t have been. I got the code to parse with this:

Instead of asking Ganon about a topic listed in the Table of Emporium Goods in Ganon's Emporium:
	say "[answer entry]";
	if answer entry is:
	-- "armorTbl": display armor table;
	-- "equipTbl": display equipment table;
[	-- "weaponsTbl": display weapons table;]
	-- otherwise:
		say "Not my business.";

I commented out the weaponsTbl line because it doesn’t exist yet (which the parser caught).

Hey @Falsoon2 the [code] tags don’t actually work on Discourse, though they did back on phpBB, so your confusion is understandable.

Please use three backticks ``` on a line before and after your code to preserve monospace formatting and tabs.

Instead of using the [code] tags:
     use ``` instead.

It looks like this when you type it:

Screenshot 2024-10-04 at 3.53.18 PM

2 Likes

Hanon,
Are you saying the code tag ONLY works on the Forum board but not on Discourse, which I don’t use? The code blocks looks fine but you want me to use the triple primes instead?

Maybe I’m not understanding. I’m talking about the intfiction.org Discourse forum we’re on (not “Discord” the chat platform which I frequently mix up with Discourse the forum software)
Are you submitting your messages on the forum website or via email perhaps?

Here’s what I’m seeing: you’ve got a [code] block which is not a tag that works on Discourse.

Screenshot 2024-10-05 at 12.45.31 PM

If you didn’t mean to format code and just meant “here is the code” I apologize for nitpicking.

2 Likes

I don’t know how my Forum post got to Discourse (or Discord). I posted to the forum as usual.

Discourse is the software that this forum is running.

Hanon was just pointing out that you had a [code] tag in your first post in this thread, and that doesn’t work to provide the special code formatting here (it used to on the old PHPBB version of this forum, but that was years ago).

3 Likes

I’m still not sure what I’m doing wrong. What should I type?
I’ve been using code…/code tags for years here.

Three back ticks ``` to open and close a code block.

Or highlight and use the </> button (which does the same thing).