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