Trouble with applying properties to objects.

Hi all,
I’ve run into a bothersome problem with my source code. I took the money source from the Inform 7 website and tweaked it to fit my needs, but now that I’m starting to create objects, I have run into the problem that i cannot attribute my property “worth” to any of them. All that the debugger spits out is that "the property worth for [object] is not allowed to exist. Neither setting the worth to 0 or any other number works in allowing the game to compile. Here is my source code, sorry if it’s a little long. Some parts towards the top are incomplete but are not of any effect on the money system. Also disregard the portions in brackets as those are just reference materials or previous experiments that failed.

Money is a kind of thing. Money has a number called worth. The worth of money is usually 25.
The player carries a wallet. The wallet contains money. The printed name of the money is "[worth of the money] gold coins".
Understand "gold coins" as the money.
Definition: a thing is free if the worth of it is 0.
Definition: the money is free if the worth of it is 0.
Definition: a thing is for sale if it is not free.
Instead of taking something for sale, say "You'll have to pay for that."
Before buying something for sale when the money is not in the wallet, say "You're broke." instead.
Before buying something for sale when the money is free, say "You're broke." instead.
Before buying something for sale when the worth of the money is less than the worth of the noun, say "You don't have enough money for that."
Instead of buying an object:
	decrease the worth of the money by the worth of the noun;
	say "You fork over [the worth of noun] for [the noun], leaving yourself with [the worth of the money].";
	now the worth is 0;
	now the player is carrying the noun.

[An object has a number called value. Price is a kind of value. 10 gold specifies a price. An object has a price. The price of an object is usually 0 gold. After examining something for sale, say "It can be yours for [the price of the noun]"
Definition: an object is free if the price is 0 gold.
Definition: a thing is for sale if it is not free.
Instead of taking something for sale, say "You'll have to pay for that."
Before buying something for sale when the money is not in the wallet, say "You're broke." instead.
Before buying something for sale when the money is free, say "You're broke." instead.
Before buying something for sale when the price of the money is less than the price of the noun, say "You don't have enough money for that."
Instead of buying something:
	decrease the price of the money by the price of the noun;
	say "You fork over [the price of the noun] for [the noun], leaving yourself with [the price of the money].";
	if the money is free, remove the money from play;
	now the price of the noun is 0 gold;
	now the player is carrying the noun. 
The player carries a wallet. The wallet contains money. The printed name of the money is "[price of the money] in gold". Understand "gold" as the money. 
Instead of taking the money:
	say "Best to leave it alone until you need to buy something." 
Instead of buying something free:
	say "[The noun] is yours already." 
Instead of buying the money:
	say "The money belongs to you; you buy things with it." ]

[Talking is an action applying to a person.
Understand "Talk to [someone]" as talking.
Understand "Talk to [Grunmin]" as talking. 
Understand "Talk" as talking.]

Player is carrying a Stubby dagger, a Burlap Pouch, and a contract.
The burlap pouch is an openable container which is closed.
The description of the burlap pouch is "This will conceal what's inside quite nicely."

The brilliant gem is inside the burlap pouch.
The contract is an object.
The worth of the contract is 0.
The description of the contract is "Your official orders, signed by a mysterious man."
The gold pieces are an object.
The description of the gold pieces is "Don't lose them!"
The description of the stubby dagger is "Pointy!"

[LOF sequence]

The treasury is a room. The description of the tresury is "The ceiling is supported by ornately decorated pillars. There are small windows that let i na cascade of light. The walls are lined with priceless artifacts dating back thousands of years. but all you're inerested in is the shining gem that is found in the center of the room on a pedestal."
	The Brillinat Gem is in the treasury.
	The Brilliant Gem is an object.
	The worth of the Brilliant Gem is 0.
	The description of the brilliant gem is "A gem of absolute perfection. The facets number in the hundreds, refracting light with such perfect geometry, it is almost blinding."

[End of Street]

The End of Street is a room.
	After entering End of Street for the first time, say "Your faith in your acrobatic skills has paid off! You have miraculously landed relatively unscathed in a hay cart parked just off the street."
	The description of the End of Street is "You have successfully escaped and the guards have lost you. You take some time to look around. This street ends to the north with a mound of garbage. To the west, the towering wall of the keep rises, and gradually forms the tower from which you miraculously leaped. To the east is an almost forgotten stable, with only a couple of skinny, sleeping horses. There is a visible increase in commotion and traffic as the street continues to the south."
	The hay cart is in the street.
	The garbage pile is in the street.
	The hay cart is scenery.
	The garbage pile is scenery.
	Instead of going west in the End of Street, say "There is a wall there."
	Instead of going north in the End of Street, say "There is a pile of garbage and a wall there."
	Instead of examining the hay cart in the End of Street, say "Can you find the needle? Good luck!"
	Instead of examining the garbage pile in the End of Street, say "It's filthy in there."
	West of the street is a wall.
	
	East of the street is a Stable.
[Stable]
The Stable is a room.
	The description of the Stable is "This stable has obviously been neglected and is in a poor state. A small anvil and tools sit in the corner, rusting away. The horses are sleeping, though they look like they haven't been fed in days. They are of no use to anyone."
	The wooden crate is inside the Stable.
	The description of the wooden crate is "An ordinary crate."
	The wooden crate is a supporter.
	Instead of taking the wooden crate, say "What would you do with a wooden crate?"
	The hammer is an object.
	The worth of the hammer is 0.
	After taking the hammer, increase the score by 1.
	The hammer is on the wooden crate.
	The description of the hammer is "An ordinary hammer."
	The anvil is in the stable.
	The anvil is an object.
	Instead of taking the anvil, say "It's way too heavy!"
	The description of the anvil is "This anvil has seen its fair share of beatings."
	The hay bale is in the Stable.
	The hay bale is scenery.
	The few horses are in the stable. 
	The few horses are scenery.
	The description of the few horses is "They look terribly underfed."
	The description of the hay bale is "Keep looking!"
	Instead of going north in the stable, say "There are horse pens there."
	Instead of going east in the stable, say "There is a wall there."
	Instead of going south in the stable, say "There is a wall there."
	
	South of the Street is Street Part Two.
[Street, part two]
The Street Part Two is a room.
	After going to Street Part Two for the first time, say "As you walk down the street, the scene becomes merrier. Everyone is going about their business, but this is no time for people-watching, because soon, word of your deeds will reach the streets.
	
	You step forward, and, almost immediately, hear a guard call out:
	
	'Oy! You there!'

	You stop and look over your shoulder, fully expecting to see a guard about to tackle you, but instead notice a scrubby stall-keeper--presumably a conjurer, judging by the stacks of scrolls and other magical-looking wares heaped on her cart--frantically packing up.
	
	'Oy! Stop right thar! Show me your peddling license!', bellows the city  guard once more, but by then the stall-keeper had already began to run. You notice that in her rush, she dropped a small scroll.
	
	'Bloody illegal peddlers! Faster than the damned sewer rats, they are! More of them too, that's for sure.' The guard looks like he could do with one less meat pie, but you commend him for actually being awake."
	The description of Street Part Two is "The guard is now asleep, following his great effort in standing around yelling at a peddler. The normal traffic has returned to the street following the ordeal."
	Five gold coins are in the Street Part Two.
	The description of the people is "They're all doing something different."
	The guard is scenery.
	The description of the guard is "Must be dreaming of meat pies."
	Instead of going east in Street Part Two, say "There is a wall there."
	Instead of going west in Street Part Two, say "There is a wall there."
	
	South of the Street Part Two is a Crossroads.
[Crossroads]
The Crossroads is a room.
	The description of the Crossroads is "The street bleeds out into a bustling crossroads. There is a billboard in the center of the crossroads, advertising the businesses to the east. The advertisements read:
	
	'Grunmin's Smithy: Small Gold, Big Metal!'
	
	'Lysar's Bows: Straightest fletch in all the land!'
	
	'Yazstromo's Brewery: Magically Intoxicating or Your Money Back!'"
	The Business Plaza is east of the Crossroads.
	The a Street to Center of City is west of the Crossroads.
	The Street to Slums is south of the Crossroads.
	
East of the Crossroads is The Business Plaza.	
[Business Plaza]
The Business Plaza is a room.
	The description of the Business Plaza is "These seem to be the shops you just read about on the billboard. The smithy lies to the north, with the fletcher to the south and the herbalist to the east."
	North of the Business Plaza is the Grunmin's Smithy.
	East of the Business Plaza is the Yazstromo's Brewery.
	South of the Business Plaza is the Lysar's Bows.
	
	[Smithy]
	The Grunmin's Smithy is a room.
	The description of Grunmin's Smithy is "You enter a dark and smoggy room, with the front wall missing for ventilation. You can see a large bellows, piping air into the heart of a huge forge. An equally giant anvil is present directly in front of the forge. You wonder if these items are truly this large, or if your perception is altered by Grunmin's unusual height."
	In the Grunmin's Smithy is a man called Grunmin.
	The description of Grunmin is "A local dwarf who practices the smithing arts. His face is covered in soot from the forge, and sweat drenches his brow. He may be stout, but he is not short of spirit!"
	The bellows are scenery.
	The forge is scenery.
	The great anvil is scenery.
		The sword is an object.
		The description of the sword is "Made from the finest dwarven steel and sharpened to a fine blade. It would take the head off a goblin in one fell swoop.".
		The worth of the sword is 10.
	Instead of going north in Grunmin's Smithy, say "There is a large forge there."
	Instead of going east in Grunmin's Smithy, say "There is a wall there."
	Instead of going west in Grunmin's Smithy, say "There is a wall there."
	
	[Brewery]
	The Yaztromo's Brewery is a room.
	In the Yazstromo's Brewery is a man called Yazstromo.
	The description of Yaztromo is "A scraggly little goblin-like creature, he is very exciteable. He could do with a few less energy potions."
	Instead of going north in Yazstromo's Brewery, say "There is a wall there."
	Instead of going east in Yazstromo's Brewery, say "There is a wall there."
	Instead of going south in Yazstromo's Brewery, say "There is a wall there."
	
	[Bows]
	The Lysar's Bows is a room.
	The description of Lysar's Bows is "A neatly arranged archery shop. The place has an air of majesty around it, even though the shelves are barren."
	In the Lysar's Bows is a woman called Lysar.
	The description of Lysar is "A tall, elegant elf. She walks with strong strides and almost looks like nobility. Her deep blue eyes are almost as piercing as the arrows she expertly crafts."
	Instead of going south in Lysar's Bows, say "There is a wall there."
	Instead of going east in Lysar's Bows, say "There is a wall there."
	Instead of going west in Lysar's Bows, say "There is a wall there."
	Instead of taling to lysar, say "She looks somewhat distraught and it would not be wise to come between an elf and her deep thoughts. You decide not to talk to her."
	

I would like to set up a simple as can be shop system in the future maybe without even implementing conversation. But for now, I am stumped as far a assigning values to certain objects. Any help would be appreciated at this point. Thank you for your time :slight_smile:

You can’t use a property unless you say it exists first (“a thing has a number called worth”). I’d also recommend using a kind of value instead of a bare number.

Also, you don’t need to close off invalid exits by hand (all the “there is a wall there” stuff), Inform does that for you.

Thank you! That seems to have worked :slight_smile: It also got rid of the P10 run-time error stating that properties are not allowed. I guess all it takes is expressly saying “an object has a number called worth.” Thank you so much!

You also mentioned values: how would I implement those and what part of the money system would they improve? Again I’m kind of a noob :stuck_out_tongue:
Thanks a million for your speedy reply! I love the reliable expertise of this forum :slight_smile:

Edit: Also, for some reason, it doesn’t want to print the text I’ve told it to print right after entering a room. All of the first rooms are failing to execute that after command which would trigger the game to print a block of text.

[Treasury]
The Treasury is a room. 
The description of the Treasury is "Armed guards are attempting to break down the door behind you. You have barricaded the door with an antique silver chest and jammed the handles with a jewel encrusted hand-and-a-half sword. They look like they are starting to give. The ceiling is supported by ornately decorated pillars. There are small windows that let in a cascade of light. The walls are lined with priceless artifacts dating back thousands of years. But all you're inerested in is the shining gem that is found in the center of the room on a pedestal."
	The Brilliant Gem is in the Treasury.
	The Brilliant Gem is an object.
	[The worth of the Brilliant Gem is 0.]
	The description of the brilliant gem is "A gem of absolute perfection. The facets number in the hundreds, refracting light with such perfect geometry, it is almost blinding."
	[After taking the Brilliant Gem for the first time, first open the burlap pouch, then put the Brilliant Gem in the burlap pouch, then close the burlap pouch, and say "You take the gem and quickly stash it in your pouch, where it will seem less conspicuous."]
	Instead of going north in the Treasury, say "There is a wall there."
	Instead of going east in the Treasury, say "There is a wall there."
	Instead of going south in the Treasury, say "There is a wall there."
	Instead of going west in the Treasury, say "There is a wall there."
	There is a staircase between the Treasury and the Rooftops.
	[Understand "Go up  the pillar" as going up the staircase.
	Understand "Up the pillar" as going up the staircase.
	Understand "Up pillar" as going up the staircase.]
	The Rooftops are above the Treasury.
	
[Rooftops]
The Rooftops are a room.
After entering the Rooftops for the first time: say "You climb up one of the ornate pillars with relative ease, thanks to the centuries old carvings that were made in their sides. You squeeze through the small window and come out on the rooftops of the city just as the barricade breaks, leaving the guards below in confusion."
	The description of the Rooftops is "The rooftops are very open and should allow the guards to easily spot you. Better move fast. There is a watchtower here with a staircase leading up."
	Instead of going north in the Rooftops, say "There is a ledge there."
	Instead of going east in the Rooftops, say "There is a ledge there."
	Instead of going south in the Rooftops, say "There is a ledge there."
	Instead of going west in the Rooftops, say "There is a ledge there."
	[Understand "Go up the stairs" as going up.
	Understand "Up the stairs" as going up.
	Understand "Up stairs" as going up.]
	The Tower Stairs is above the Rooftops.
	
[Tower Stairs]
The Tower Stairs is a room.
After entering the Tower Stairs for the first time: say "As you climb up the winding staircase, you confront a guard. Caught off guard, he has no time to draw his sword and you deliver a swift stab to his abdomen, followed by a few punches to the temples. He is now unconcious. The stairs lead up."
	Instead of going north in the Tower Stairs, say "There is a wall there."
	Instead of going east in the Tower Stairs, say "There is a wall there."
	Instead of going south in the Tower Stairs, say "There is a wall there."
	Instead of going west in the Tower Stairs, say "There is a wall there."
	[Understand "Go up the stairs" as going up.
	Understand "Up the stairs" as going up.
	Understand "Up stairs" as going up.]
	The Top of Tower is above the Tower Stairs.

[Top of Tower]
The Top of Tower is a room.
After entering the Top of Tower for the first time: say "You climb up onto the main platform of the watchtower. You hear guards downstairs have noticed the body and are coming up. There is an anchor point to the east that is overhanging a street down below. Do you dare?"
	Instead of jumping in the Top of Tower, move the player to End of Street.
	Instead of going north in the Top of Tower, say "There is a ledge overhanging a very hard roof there."
	Instead of going east in the Top of Tower, say "There is a ledge overhanging a very hard roof there."
	Instead of going south in the Top of Tower, say "There is a ledge overhanging a very hard roof there."
	The End of Street is west of Top of Tower.

[End of Street]
The End of Street is a room.
After entering End of Street for the first time: say "You jump straight off of the anchor point of the tower, disregarding the chance of death, for certain death awaits you if you stay here any longer. But your faith in your acrobatic skills has ultimately paid off! You have miraculously landed relatively unscathed in a hay cart parked just off the street."
	The description of the End of Street is "You have successfully escaped and the guards have lost you. You take some time to look around. This street ends to the north with a mound of garbage. To the west, the towering wall of the keep rises, and gradually forms the tower from which you miraculously leaped. To the east is an almost forgotten stable, with only a couple of skinny, sleeping horses. There is a visible increase in commotion and traffic as the street continues to the south."

“Entering” is a different action than “going”: entering is when you get into a container or vehicle. You want “going to” in this case, just replace that and it’ll work.

Again, you can remove the “instead” rules, Inform does that for you. Or lump them all into one “instead of going nowhere in the [room name]” rule.

You seem to have played around with types of value, that’s what all the stuff about “0 gold” referred to in your earlier code sample.

Be careful about before/after rules while going: the text might not print in the order you intend.

“Entering” does not apply to rooms, it’s for when you enter an enterable container. Frustrating, I know.

Try “after going to the Top of the Tower for the first time:”

Thanks guys for the help and changing the wording did fix the problem. However there is still a small lingering issue: after the player jumps off the tower, the text also fails to print. Is it considered visiting a room if the game itself moves the player? Because this would make the problem make sense.

Here is the code:

	Instead of jumping in the Top of Tower, move the player to End of Street.
	Instead of going north in the Top of Tower, say "There is a ledge overhanging a very hard roof there."
	Instead of going east in the Top of Tower, say "There is a ledge overhanging a very hard roof there."
	Instead of going south in the Top of Tower, say "There is a ledge overhanging a very hard roof there."
	The End of Street is west of Top of Tower.

[End of Street]
The End of Street is a room.
After going to the End of Street for the first time: say "You jump straight off of the anchor point of the tower, disregarding the chance of death, for certain death awaits you if you stay here any longer. But your faith in your acrobatic skills has ultimately paid off! You have miraculously landed relatively unscathed in a hay cart parked just off the street."
	The description of the End of Street is "You have successfully escaped and the guards have lost you. You take some time to look around. This street ends to the north with a mound of garbage. To the west, the towering wall of the keep rises, and gradually forms the tower from which you miraculously leaped. To the east is an almost forgotten stable, with only a couple of skinny, sleeping horses. There is a visible increase in commotion and traffic as the street continues to the south."
	The hay cart is in the street.

Thanks again for all the help! :wink:

A rule with an action name in it (like “going”) only applies if that action happens. If there’s no “going” action, the rule doesn’t fire. If it’s supposed to print when the player jumps, why not put it in the rule about jumping?

And again, you really don’t need all of the instead of going rules for directions you aren’t using. Inform handles all of that automatically. And even if you want to override it, you’re missing six directions each time (ne, nw, se, sw, up, down).

I get where you’re coming from, but the thing is, I am telling the system that instead of jumping, it should move the player, therefore never executing the jump command. I’m kind of confused at this point. And yes, I realized that there is no point in outlining walls, I just did all that before I knew and kind of don’t want to erase it all haha. Thanks again for the continued support and I’ll be on the lookout for new solutions.

Well, this is kind of half right. If you look at section 12.2 of Writing with Inform, it gives you a chart of all the kinds of rule that ordinarily apply to an action, in the order they apply in. If the player’s command is understood at all, it’s going to be turned into an action, and it’s going to start on the rules for that action. So you really are executing the jump command in the sense that you’re starting on the rules for the jumping action.

But there is a sense in which you don’t execute the jump action: Your instead of jumping rule, when it executes, cuts off the execution of the jumping command. That’s what instead rules do; after they run they stop the rules for the action (unless you include a special phrase that tells them not to stop, usually “continue the action”). So the usual report jumping rule, which prints “You jump on the spot,” doesn’t happen.

Still, in this case that won’t keep you from doing what you want. You want a special message to print when the player jumps from the Top of Tower to End of Street. You can put that message in the same “Instead of jumping” rule that moves the player, like this:

Instead of jumping in the Top of Tower: say "Your message here."; move the player to the End of Street.

This is usually how you want to handle “Instead” rules; they should both print whatever text you want to be printed and carry out whatever effects you want them to have. Since “move the player…” isn’t an action, you can’t use that as a hook for printing text; and since the text specifically refers to the player jumping, it should be in one of the rules that runs when the player jumps.

If you wanted some text to print before the player enters a room for the first time by any means, there are probably ways to make that happen, but they’d be much trickier – and it’s pretty clearly not what you want here, since the message you’re printing is tied specifically to jumping.

Thanks so much! I had completely forgotten about being able to format your rules in that cascading manner. I never knew it actually executed the command even though the instead rule was present. Very interesting. Thanks again for all your help, guys, as always you were very thorough and quick to respond. Have a great day! :slight_smile:

Hmm, this is actually helpful to me too. As i am quite new, and would like to use descriptions as well. Thanks for asking the question. :slight_smile: