mandybrigwell
Member
I've been trying to write a script that checks the cost of all six tiny plastic sword drinks, then overdrinks one for me. Ideally, I'll like to run through an array of the six drinks finding their costs, then find the largest one and drink it. I don't seem to be able to do that - I've read the bits about maps, including 'A Noobs Guide to Maps', but I'm getting nowhere. I've trawled through a variety of scripts looking for parts where maps are defined, and I still don't seem to be able to work it out. Rest assured I've not given up after two minutes and registered an account for an easy ride - I really am completely stuck.
You'll see how stuck I am when I reveal that I've resorted to the following, totally inelegant hash-job, which won't even drink the thing at the end because I seem to be passing back a string instead of an item or something, so putting overdrink(1, drink) doesn't work. Any help at all would be greatly, greatly appreciated.
You'll see how stuck I am when I reveal that I've resorted to the following, totally inelegant hash-job, which won't even drink the thing at the end because I seem to be passing back a string instead of an item or something, so putting overdrink(1, drink) doesn't work. Any help at all would be greatly, greatly appreciated.
Code:
void main() {
int cherryCost = mall_price($item[cherry]);
int jumboOliveCost = mall_price($item[jumbo olive]);
int limeCost = mall_price($item[lime]);
int dirtyMartiniCost = mall_price($item[dry martini]) + jumboOliveCost;
int vesperCost = mall_price($item[dry vodka martini]) + jumboOliveCost;
int sangriaDelDiabloCost = mall_price($item[sangria]) + cherryCost;
int cherryBombCost = mall_price($item[old-fashioned]) + cherryCost;
int bodyslamCost = mall_price($item[tequila with training wheels]) + limeCost;
int grogtiniCost = mall_price($item[grog]) + limeCost;
int currentCost = dirtyMartiniCost;
string drink = "Dirty Martini";
if (vesperCost <= dirtyMartiniCost) {
currentCost = vesperCost;
drink = "Vesper";
}
if (sangriaDelDiabloCost <= vesperCost) {
currentCost = sangriaDelDiabloCost;
drink = "Sangria Del Diablo";
}
if (cherryBombCost <= sangriaDelDiabloCost) {
currentCost = cherryBombCost;
drink = "Cherry Bomb";
}
if (bodyslamCost <= cherryBombCost) {
currentCost = bodyslamCost;
drink = "Bodyslam";
}
if (grogtiniCost <= bodyslamCost) {
currentCost = grogtiniCost;
drink = "Grogtini";
}
print ("Buy a " + drink + " for " + currentCost);
}