I created a database in a script called 'database':
db:create("worldstock", {
elixirs={
type="",
shop="",
cost=0
},
tonics={
type="",
shop="",
cost=0
},
herbs={
type="",
shop="",
cost=0
},
minerals={
type="",
shop="",
cost=0
},
inks={
type="",
shop="",
cost=0
},
sigils={
type="",
shop="",
cost=0
},
bombs={
type="",
shop="",
cost=0
},
enchantments={
type="",
shop="",
cost=0
}
})
Then I created a trigger to update the elixirs section:
-- patern: ^\s+tun\d+ an elixir of (\w+) \(refill only\)\s+\d+\s+(\d+)gp$
updateElixir(matches[2],mmp.currentroomname,matches[3])
In my main script, I have two functions defined:
function updateElixir (name,where,price)
local mydb = db:get_database("worldstock")
db:add(mydb.elixirs, {type=""..name.."", shop=""..where.."",cost=price})
end
function listElixirs()
local mydb = db:get_database("worldstock")
local dbResults = db:fetch(mydb.elixirs)
display(dbResults)
end
I know the trigger fires, because I had it echo me the results. So I assume everything is working, except my alias, DBLIST ELIXIRS, which calls
listElixirs(), does not produce any results. Can someone possibly diagnose from what is given where my problem lies? Thanks so much for any help!