Help to make a tip jar?

Yukari
30 May 2014, 01:36
Hello! I am new in all this (text games, make text games, and this forum) and I trying to do a tip jar, where you can leave a tip only if you buy sometime in the store. I started pretty good when work with only one item to buy.

What I do was used the attribute "If" the player have the object ___ (coffee in this case), then print the message ___("you leave a tip").

And add the attribute "If" the player dont have the object___ (coffe), then print the message__ ("Is a little weird leave a tip without buying nothing)".

Run fine but this method work only if I do it with a single object. If the player buy "candy" (for example) and not coffee then the tip jar print "Is a little weird...". Because if I tried to put the same atribbute I mention before i more that a single item the game print a error.

So, what I want is the player can leave a tip buying whatever object want. I think I need something like:

If the player have ___(coffe) and/or ____ (candy) then print____

The question is how I do that? Or what is the alternative?

Note:
1) I really, really, sorry for my bad english, is not my native language.

2) I dont leave the game because is in spanhis. But if you guys think it will be useful let me know.

3) I really, really,really, really, really, really, sorry for my bad english, is not my native language.

HegemonKhan
30 May 2014, 02:36
very simple method:

1 object:

if [EXPRESSION] coffee.parent=player
-> then, print a message "you leave a tip"
else, print a message "Is a little weird leave a tip without buying nothing"

2 objects:

if [EXPRESSION] coffee.parent=player or candy.parent=player
-> then, print a message "you leave a tip"
else, print a message "Is a little weird leave a tip without buying nothing"

3 objects:

if [EXPRESSION] coffee.parent=player or candy.parent=player or soda.parent=player
-> then, print a message "you leave a tip"
else, print a message "Is a little weird leave a tip without buying nothing"

4 objects:

if [EXPRESSION] coffee.parent=player or candy.parent=player or soda.parent=player or pizza.parent=player
-> then, print a message "you leave a tip"
else, print a message "Is a little weird leave a tip without buying nothing"

5 objects:

(you get the idea or pattern, hehe)

----------------

ONLY with ALL 4 objects TOGETHER:

if [EXPRESSION] coffee.parent=player and candy.parent=player and soda.parent=player and pizza.parent=player
-> then, print a message "you leave a tip"
else, print a message "Is a little weird leave a tip without buying nothing"

// if player has only coffee, then output: "Is a little weird leave a tip without buying nothing"
// if player has only pizza, then output: "Is a little weird leave a tip without buying nothing"
// if player has coffee, candy, and soda, then output: "Is a little weird leave a tip without buying nothing"
// if player has coffee, candy, soda, and pizza, then output: "you leave a tip"

--------------

there's better ways to do what you want, but it might be hard for me to explain in english, whereas someone who can speak your language can help you better, obviously. As to show you better ways of doing things, means I'll need to explain them so that you can understand how and why they work, which will be difficult if you don't understand english well.

I'm sure we got people here who can help you in our language, what is your native language?

ah, spanish... I think user 'm4u' knows spanish (he~she is helping with translating quest to spanish, I think), and we certainly have many other users who know spanish too. Hopefully, one of them can help you out.

Yukari
30 May 2014, 03:32
Thaks HegemonKhan! your instructions are very clear, I almost got it ready :)