Shop?

Ok. This is probably the last thing I’ll need help with in the farming series. I’m trying to create a shop where people can exchange their tomatoes for points and use those points to buy more seeds or fun items or whatever. I’d like there to be a table showing what you can buy and for how much. I already have the exchange part done but I have no Idea of where to start with the rest. Help?

nursery is a room.

Storage is a room.

Shop is east of Nursery.
"Welcome to our store! If you have any tomato fruits you can exchange them for points! If you'd like to exchange your fruits for points, say, EXCHANGE  'number' TOMATO FRUITS. If you'd like to buy something, say BUY item."

Check tomato exchange:
unless the noun is a tomato fruit, say "You can only exchange a tomato fruit." instead

tomato exchange is an action applying to one visible thing.

Understand "exchange [things]" as tomato exchange.

carry out tomato exchange:
	award 5 points;
	say " you have [score] points";
	move the noun to storage;

a tomato fruit is a kind of thing. 

I couldn’t get it to work with tables, since it doesn’t seem to like kinds of values. However, you could try this.

[code]“Test”

A thing is either exchangeable or unexchangeable. A thing is either usually unexchangeable.

Everything has a number called price. The price of a thing is usually 0.

Tomato exchange is an action applying to one visible thing. Understand “Exchange [things]” as tomato exchange.

Check tomato exchange:
if the noun is unexchangeable, say “You can’t exchange [the noun]!” instead.

Carry out tomato exchange:
increase the score by the price of the noun;
move the noun to storage;
say “You have [score] points.”.

A tomato fruit is a kind of thing. A tomato fruit is exchangeable. The price of a tomato fruit is 5. There are 10 tomato fruits in the nursery.

The Nursery is A Room. Storage is A Room.

The Shop is east of The Nursery. The description of the shop is “Welcome to our store! If you have any tomato fruits you can exchange them for points! If you’d like to exchange your fruits for points, say, EXCHANGE ‘number’ TOMATO FRUITS. If you’d like to buy something, say BUY item.”.

Test me with “take all fruits / e / exchange all fruits / exchange self”.[/code]

You give everything the exchangeable/unexchangeable property and a price. Here, the player can’t exchange items that are unexchangeable and will get a number of points determined by the price value when exchanging something that is.

Hope this helps.

I think I got that part, but what I was really asking about was the buying part.

Actually, I think I have it, and your post helped a lot! Thanks! :smiley: