From 2e131bd3cbb2acb6ef52e7ad85f354ede543a392 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 20 Aug 2007 10:48:20 +0000 Subject: Defined two helper functions to abstract away money being available under inventory index 0. --- data/test.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'data/test.lua') diff --git a/data/test.lua b/data/test.lua index 817c5ce0..6254225a 100644 --- a/data/test.lua +++ b/data/test.lua @@ -11,7 +11,11 @@ function my_npc1(npc, ch) do_message(npc, ch, "Hello! I am the testing NPC.") do_message(npc, ch, "This message is just here for testing intertwined connections.") do_message(npc, ch, "What do you want?") - local v = do_choice(npc, ch, "Guns! Lots of guns!", "A Christmas party!", "To buy.", "To sell.", "To make a donation.") + local v = do_choice(npc, ch, "Guns! Lots of guns!", + "A Christmas party!", + "To buy.", + "To sell.", + "To make a donation.") if v == 1 then do_message(npc, ch, "Sorry, this is a heroic-fantasy game, I do not have any gun.") elseif v == 2 then @@ -30,8 +34,8 @@ function my_npc1(npc, ch) elseif v == 4 then tmw.npc_trade(npc, ch, true, { {511, 10, 200}, {524, 10, 300}, {508, 10, 500}, {537, 10, 25} }) elseif v == 5 then - if tmw.chr_inv_change(ch, 0, -100) then - do_message(npc, ch, string.format("Thank you for you patronage! You are left with %d gil.", tmw.chr_inv_count(ch, 0))) + if tmw.chr_money_change(ch, -100) then + do_message(npc, ch, string.format("Thank you for you patronage! You are left with %d gil.", tmw.chr_money(ch))) else do_message(npc, ch, "I would feel bad taking money from someone that poor.") end -- cgit v1.2.3-60-g2f50