The Dink Network

Reply to Potion puzzle

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
January 31st 2018, 05:06 AM
duck.gif
Toof
Peasant He/Him
I disagree. 
Here is a little brain teaser that I've got on my hands (and if this turns out to be a monstrosity of a code, forget about it). Also, I don't need an exact script for everything, just a logic behind it (unless, there is a command I maybe that I don't know about).

So, Dink is helping an alchemist, and has to make potions for him. There are, say... 5 potions player should know how to make, and each of them has few of 5 ingredients.

Lets call em 1stPotion, 2ndPotion, etc... and ingredients 1stIng, 2ndIng, and so on. Just to make it clear, let's say that:

1stPotion = 1stIng + 4thIng
2ndPotion = 3rdIng + 1stIng + 5thIng
3rdPotion = 3rdIng + 3rdIng + 1st Ing etc

The order of putting ingredients into pot doesn't matter.

Finally, the alchemist should walk in three times in a row, and ask Dink for a random 1-5 potion to make. This opens a list of all ingredients, and a 'finish' button. Player must know when to finish, and ingredients don't diminish... from the list after being used, cause some of them are might needed twice.

My solution kinda goes like this:
each potion and ingredient is a global variable with a specific number value, say:

1stPotion = 5; 1stIng = 2; 4thIng = 3

So when you add values of ingredients needed, you get the value of potion wanted. I just have to try and avoid the possibility of making same sums with wrong input, by using numbers of very different value.
Is this possible to do? ( Yes / Nooooooooooooooooooooo )

So, finally, how do I make alchemist to order some random potion, and then open a menu with ingredients after which the engine knows which potion is needed to be made?