Been experimenting with defining objects via table. I performed a text search of “are defined by the Table” which took me to Chapter 15.16 of the manual “Defining things with tables.” I’d actually read that during my lunch at work a couple of weeks ago and it just hadn’t clicked in my 2-bit brain. However there’s not much more information on using tables in this manner. I’m particularly interested in knowing if you can pre-set the locations of things defined by table, including divvying them up as the possessions of other characters.
I’ve been endeavouring to figure this out (while it may not appear so, I do try to learn by my own effort. I’m just not very good at learning).
My attempt here was to use a table column called “Location” to assign the things to their rooms (currently only 2 rooms exist here). It seemed a reasonable guess, given that “Location” is one of the properties of things as revealed by the Showme command.
Eg:
Showme Nugget
Gold nugget - treasure
location: in Building
singular-named, proper-named; unlit, inedible, portable
printed name: “Gold nugget”
printed plural name: “treasures”
indefinite article: none
description: “Sparkly”
initial appearance: none
treasure_points: 10
Location: Building
treasure_description: “Sparkly”
[code]“Treasures”
Building is a room. “You are inside a building, a well house for a large spring…”
End of road is a room. “You are standing at the end of a road before a small brick building.” End of road is west of Building. End of road is outside from Building.
The player is in building. A man called Smith is in building.
Persuasion rule for asking someone to try doing something: persuasion succeeds.
A treasure is a kind of thing. A treasure has a number called treasure_points.
Some treasures in the Building are defined by the Table of Treasure Scores. The description of a treasure is “[treasure_description]”.
Table 1.0 - Treasure Scores
treasure Location treasure_points treasure_description
Gold nugget Building 10 “Sparkly”
Diamonds Building 20 “Glittery”
Silver bars Building 5 “Smooth and silvery”
Jewelry Building 5 “Assorted gems and trinkets”
Rare coins Building 10 “Varied”
Emerald Building 25 “The size of a plover’s eg”
Platinum Pyramid Building 30 “30 inches on a side”
Pirate’s Treasure Building 30 “Nondescript”
Check examining a treasure:
instead say “The [The noun], [description of the noun] is worth [treasure_points of noun].”[/code]
It appears to work OK, but the player is unable to move. This is the result if you try going to the adjacent location:
[code]>out
*** Run-time problem P10: Since yourself is not allowed the property “location”, it is against the rules to try to use it.
[** Programming error: tried to “move” yourself to nothing **]
You get out of Building.[/code]
(NOTE: Although it says so, you actually remain in the building).
[code]>w
*** Run-time problem P10: Since yourself is not allowed the property “location”, it is against the rules to try to use it.
You’ll have to get out of Building first.[/code]
It also affects the NPC:
[code]>smith, w
*** Run-time problem P10: Since Smith is not allowed the property “location”, it is against the rules to try to use it.
Smith is unable to do that.[/code]
Interesting. Any idea why the table is messing up the player & NPC location properties?