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.
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).
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.
If you didn’t mean to format code and just meant “here is the code” I apologize for nitpicking.
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).