So, what is the problem? When I enter the tavern, and order a drink, I get the message "Who will drink" Here is where the problem comes in. If I select a character (in this case F3), it sometimes works (and goes to the next part), while other times it does not work, and gives me a return 1 (which keeps me in the same cell, but the script ends.) This does not happen all the time, but it does happen consistently.
The other issue is that if you order Ale, it does not regenerate BP's, as I would like it to. Well, here is the script...
Code: Select all
#A Generic Tavern in Skara Brae
from eventAPI import showPicture, playSpecAudio, optionInput, tickGame, getPartyCount, isPC, modifyGold, modifyHP, modifySP, modifyBP, giveItems, stopSpecAudio
from APIUtils import showMessage
from SDLKeys import SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_ESCAPE
from SDLKeys import SDLK_r, SDLK_t, SDLK_o, SDLK_a, SDLK_b, SDLK_m, SDLK_f, SDLK_g, SDLK_n, SDLK_y
def fireEvent(e):
showPicture(e, "Tavern")
playSpecAudio(e, "Tavern")
choice = optionInput(e, ["Welcome to Skull Tavern!", "What will be your pleasure", "", "(O)rder a Drink", "(T)alk to Barkeep", "(R)ent a Room"], ["(ESCAPE) to Exit"], [SDLK_o, SDLK_t, SDLK_r, SDLK_ESCAPE])
if (choice == SDLK_r):
rentaroom(e)
elif (choice == SDLK_t):
talk(e)
elif (choice == SDLK_o):
maindrink(e)
elif (choice == SDLK_ESCAPE):
return 0
else:
showMessage(e, ["\"I do not understand your jibberish!\""])
mainmenu(e)
def mainmenu(e):
showPicture(e, "Tavern")
playSpecAudio(e, "Tavern")
choice = optionInput(e, ["Welcome to Skull Tavern!", "What will be your pleasure", "", "(O)rder a Drink", "(T)alk to Barkeep", "(R)ent a Room"], ["(ESCAPE) to Exit"], [SDLK_o, SDLK_t, SDLK_r, SDLK_ESCAPE])
if (choice == SDLK_r):
rentaroom(e)
elif (choice == SDLK_t):
talk(e)
elif (choice == SDLK_o):
maindrink(e)
elif (choice == SDLK_ESCAPE):
return 0
else:
showMessage(e, ["\"I do not understand your jibberish!\""])
mainmenu(e)
def maindrink(e):
personlist = [SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_ESCAPE]
person = optionInput(e, ["\"Who will drink?\""],
["(F1-F8) for Character", "(ESCAPE) to Exit"],
personlist)
idx = personlist.index(person)
if (idx == 8):
showMessage(e, ["\"Come back any time!\""])
tickGame(e, 4)
return 0
elif (idx >= getPartyCount(e)):
showMessage(e, ["\"What is this, some kind of joke? There's no one there!\""])
tickGame(e, 8)
mainmenu(e)
elif (not isPC(e, idx)):
showMessage(e, ["\"We don't serve your kind in here!\""])
tickGame(e, 8)
mainmenu(e)
else:
choice = optionInput(e,
["Seat thyself. What shall I get you?",
"",
"(A)le",
"(B)eer",
"(M)ead",
"(F)oul Spirits",
"(G)inger Ale", "",
"(N)evermind"],[],
[SDLK_a, SDLK_b, SDLK_m, SDLK_f, SDLK_g, SDLK_n])
if (choice == SDLK_a):
if (optionInput(e, ["Such a fine brew will cost you 15 gold. Will ye pay?"], ["(Y)es, (N)o"], [SDLK_y, SDLK_n]) == SDLK_n):
nopay(e)
else:
if (modifyGold(e, idx, -15)):
showMessage(e, ["The ale is weak and flat, but at least it's cheap, right?"])
modifyBP(e, idx, 10)
mainmenu(e)
else:
showMessage(e, ["I know not where from you hail, but in these parts we don't give drinks on credit! Come back when you have the funds!"])
mainmenu(e)
elif (choice == SDLK_b):
if (optionInput(e, ["Such a fine brew will cost you 10 gold. Will ye pay?"], ["(Y)es, (N)o"], [SDLK_y, SDLK_n]) == SDLK_n):
nopay(e)
else:
if (modifyGold(e, idx, -10)):
showMessage(e, ["The beer is hardly drinkable, but it sooths your parched throat."])
mainmenu(e)
else:
showMessage(e, ["I know not where from you hail, but in these parts we don't give drinks on credit! Come back when you have the funds!"])
mainmenu(e)
elif (choice == SDLK_m):
if (optionInput(e, ["Such a fine brew will cost you 20 gold. Will ye pay?"], ["(Y)es, (N)o"], [SDLK_y, SDLK_n]) == SDLK_n):
nopay(e)
else:
if (modifyGold(e, idx, -20)):
showMessage(e, ["The mead seems to be more water than alcohol, but at least it's drinkable."])
mainmenu(e)
else:
showMessage(e, ["I know not where from you hail, but in these parts we don't give drinks on credit! Come back when you have the funds!"])
mainmenu(e)
elif (choice == SDLK_f):
if (optionInput(e, ["Such a fine brew will cost you 50 gold. Will ye pay?"], ["(Y)es, (N)o"], [SDLK_y, SDLK_n]) == SDLK_n):
nopay(e)
else:
if (modifyGold(e, idx, -50)):
showMessage(e, ["You start to feel a little lightheaded."])
mainmenu(e)
else:
showMessage(e, ["I know not where from you hail, but in these parts we don't give drinks on credit! Come back when you have the funds!"])
mainmenu(e)
elif (choice == SDLK_g):
if (optionInput(e, ["Such a fine brew will cost you 10 gold. Will ye pay?"], ["(Y)es, (N)o"], [SDLK_y, SDLK_n]) == SDLK_n):
nopay(e)
else:
if (modifyGold(e, idx, -10)):
showMessage(e, ["The ladies in the tavern are not impressed."])
mainmenu(e)
else:
showMessage(e, ["I know not where from you hail, but in these parts we don't give drinks on credit! Come back when you have the funds!"])
mainmenu(e)
else:
showMessage(e, ["Another time perhaps?"])
mainmenu(e)
def rentaroom(e):
if (optionInput(e, ["We have the finest beds in town, for the low cost of 1500 a night. Will you stay?"], ["(Y)es, (N)o"], [SDLK_y, SDLK_n]) == SDLK_n):
nostay(e)
else:
sleep(e)
def nostay(e):
showMessage(e, ["Come back if you change your mind."])
mainmenu(e)
def sleep(e):
if (modifyGold(e, 0, -1500)):
showMessage(e, ["You spend about 8 hours in the most comfortable beds you have ever seen. You awake to find a hearty meal laid out before you. You haven't felt this good in ages!"])
tickGame(e, 1920)
x, c = 0, getPartyCount(e)
while (x < c):
modifyHP(e, x, dice(10, 8, 1))
modifySP(e, x, dice(10, 8, 1))
x += 1
return 0
else:
showMessage(e, ["You don't seem to have the funds to stay here. Perhaps you should try a cheaper place?"])
mainmenu(e)