summaryrefslogtreecommitdiff
path: root/example/scripts/npcs/banker.lua
diff options
context:
space:
mode:
Diffstat (limited to 'example/scripts/npcs/banker.lua')
-rw-r--r--example/scripts/npcs/banker.lua38
1 files changed, 19 insertions, 19 deletions
diff --git a/example/scripts/npcs/banker.lua b/example/scripts/npcs/banker.lua
index 88ba9acd..4d5dda12 100644
--- a/example/scripts/npcs/banker.lua
+++ b/example/scripts/npcs/banker.lua
@@ -12,21 +12,21 @@
function Banker(npc, ch)
if being_get_gender(ch) == GENDER_MALE then
- npc_message("Welcome to the bank, sir!")
+ say("Welcome to the bank, sir!")
elseif being_get_gender(ch) == GENDER_FEMALE then
- npc_message("Welcome to the bank, madam!")
+ say("Welcome to the bank, madam!")
else
- npc_message("Welcome to the bank... uhm... person of unspecified gender!")
+ say("Welcome to the bank... uhm... person of unspecified gender!")
end
local account = tonumber(chr_get_quest(ch, "BankAccount"))
local result = -1
if (account == nil) then --Initial account creation, if needed
- npc_message("Hello! Would you like to setup a bank account? There is a sign-on bonus right now!")
- result = npc_choice("Yes", "No")
+ say("Hello! Would you like to setup a bank account? There is a sign-on bonus right now!")
+ result = ask("Yes", "No")
if (result == 1) then
chr_set_quest(ch, "BankAccount", 5)
- npc_message("Your account has been made. Your sign-on bonus is 5GP.")
+ say("Your account has been made. Your sign-on bonus is 5GP.")
account = 5
end
end
@@ -37,41 +37,41 @@ function Banker(npc, ch)
result = 1
while (result < 3) do --While they've choosen a valid option that isn't "Never mind"
account = tonumber(chr_get_quest(ch, "BankAccount")) --Why do I need to convert this?
- npc_message("Your balance: " .. account .. ".\nYour money: " .. chr_money(ch) .. ".")
- result = npc_choice("Deposit", "Withdraw", "Never mind")
+ say("Your balance: " .. account .. ".\nYour money: " .. chr_money(ch) .. ".")
+ result = ask("Deposit", "Withdraw", "Never mind")
if (result == 1) then --Deposit
money = chr_money(ch);
if (money > 0) then --Make sure they have money to deposit
- npc_message("How much would you like to deposit? (0 will cancel)")
- input = npc_ask_integer(0, money, 1)
+ say("How much would you like to deposit? (0 will cancel)")
+ input = ask_integer(0, money, 1)
money = chr_money(ch)
if (input > 0 and input <= money) then --Make sure something weird doesn't happen and they try to deposit more than they have
chr_money_change(ch, -input)
chr_set_quest(ch, "BankAccount", account + input)
- npc_message(input .. " GP deposited.")
+ say(input .. " GP deposited.")
elseif (input > money) then --Chosen more than they have
- npc_message("You don't have that much money. But you just did....")
+ say("You don't have that much money. But you just did....")
end
else
- npc_message("You don't have any money to deposit!")
+ say("You don't have any money to deposit!")
end
elseif (result == 2) then --Withdraw
if (account > 0) then --Make sure they have money to withdraw
- npc_message("How much would you like to withdraw? (0 will cancel)")
- input = npc_ask_integer(0, account, 1)
+ say("How much would you like to withdraw? (0 will cancel)")
+ input = ask_integer(0, account, 1)
if (input > 0 and input <= account) then --Make sure something weird doesn't happen and they try to withdraw more than they have
chr_money_change(ch, input)
chr_set_quest(ch, "BankAccount", account - input)
- npc_message(input .. " GP withdrawn.")
+ say(input .. " GP withdrawn.")
elseif (input > account) then --Chosen more than they have
- npc_message("You don't have that much in your account. But you just did....")
+ say("You don't have that much in your account. But you just did....")
end
else
- npc_message("Your account is empty!")
+ say("Your account is empty!")
end
end
end --This ends the while loop
end
- npc_message("Thank you. Come again!")
+ say("Thank you. Come again!")
end