Fishguts : ToDo List 20090912
A rough todo list;
* Re-work the “work flow” for shops
* Selling Items
* Make Inventory screen non-static, make it selectable with “Use” action
* Do Oracle / Pub code (The “How much do you offer...” code)
* Peer at Gem
* Wandering monsters (The code is already there with the shopkeepers). Really need to add a couple onto the maps and see how they behave.
* Training Halls for leveling up
The last big stint after all these small things will be the combat code, roughly;
* Quick Targeting of monsters as well as arbitrary targeting
* Melee + Ranged combat
* Magic
Shop code has turned into a small nightmare. There are lots of things that are closely related but not, and requires slightly different implementations.
I have the following kind of shops
* Food / Weapons / Armour / etc (the standard shop type)
* Oracle / Pub The “How much do you pay/offer” type deal.
* Training Hall
I have had to write a common ‘widget’ that is shared, which is the pick list / item list. Talking to NPC requires a scrolling list of keywords, shops require a scrolling list of items, etc.
I am thinking of changing my design for the oracle + pub type deal.
Initially it was going to be you offer X$ and get a response back. Now I think for oracles I’ll have different things like
== Marvin the Mystic ===
Select your desire
10$ Palm Reading
50$ Aura Reading
100$ Tea Leaf reading
500$ Tarot Cards
1000$ Bones
And variations on the theme, which gets the pick list reused again.
If I wanted to go ‘ugly’ I could re-use the framework for Talking as its fairly arbitrary and very easy to re-use, thus any ‘new’ shop could be done instantly.
Below is pretty rough but should be close to compiling I think. The only downside right now is there is no ‘multiple’s so you can only buy a qty of 1 each time, but that could be rectified by a change to the talk code to add a quantity field to the data… Then where qrt is > 1, the user could be prompted for how many to buy… that would work.
1:-- Creating Buy/Sell from talk code
2:function InitShopScreen(tblItems)
3: ClearTalkList()
4:
5: local key,val
6: for key,val in pairs(tblItems) do
7: AddToTalkList(val)
8: end
9:end
10:
11:function DoShopBuy()
12: InitShopScreen({"KNIFE", "AXE"})
13:
14: local id, kw
15: id = 0
16: while id ~= -1
17: id, kw = GetTalkInput()
18:
19: if id ~= -1 then
20: id = GetItemIndexFromName(kw)
21: if GetPlayerGold() >= GetItemCost(id) then
22: AddToInventory(id)
23: SetPlayerGold( GetPlayerGold() - GetItemCost(id) )
24: MsgBox("YOU BOUGHT : " .. GetItemName(id), " OK ", "")
25: else
26: MsgBox("YOU DONT HAVE ENOUGH CASH!", " OK ", "")
27: end
28: end
29: end
30:end
31:
32:function DoShopSell()
33: local i, id, kw
34:
35: id = 0
36: while id ~= -1
37: ClearTalkList()
38:
39: for i=1..G_MAX_INVENTORY_ITEMS do
40: local idx
41:
42: idx = GetInvnetoryItemIndex(i)
43:
44: if idx ~= -1 then
45: AddToTalkList( GetItemName(idx) )
46: end
47: end
48:
49: id, kw = GetTalkInput()
50: if id ~= -1 then
51: RemoveFromInventory(id)
52:
53: id = GetItemIndexFromName(id)
54: SetPlayerGold( GetPlayerGold() + (GetItemCost(id)/2) )
55:
56: MsgBox("SOLD FOR " .. GetItemCost(id)/2, " OK ", "")
57: end
58: end
59:end
60:
61:function DoShop()
62: local id, kw
63:
64: id = 0
65: while id ~= -1
66: InitShopScreen( { "BUY", "SELL" })
67:
68: id, kw = GetTalkInput()
69: if kw == "BUY" then DoShopBuy() end
70: elseif kw == "SELL" then DoShopSell() end
71: end
72:end
|
Going to have to rethink this train of thought. I’m kinda liking the idea of reusing my talk code and cutting out all the other special shop code.... Might have to branch my code and see how implementation goes.
Filed Under : Computers • Development • Fishguts •
Comments are closed There are no comments on this entry.