Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.

local winning = 1
for list_row in db:nrows(
"SELECT * FROM Legacy_Quest_Recipe_Table WHERE QuestSequence = 0 and QuestID=" ..
p_quest_id) do
for list_row in db:nrows(
"SELECT * FROM MasterCompTable WHERE RecipeID=" ..
list_row.RecipeID) do
if mq.TLO.FindItem(list_row.MItemID)() ~= nil then
winning = 0
end
end
end
if winning == 1 then
mq.cmd('/say recipes')
mq.delay(1000)
break
end
You are doing doevents with no delay so if the event doesn’t occur right away it will wait 1s and the flush events

function library.bank_withdrawal(p_amount)
if not mq.TLO.Window.BigBankWnd.Open() then
mq.cmd('/nomodkey /click right target')
mq.delay(1500)
end
if mq.TLO.Me.PlatinumBank() >= p_amount then
mq.cmd('/notify BigBankWnd BIGB_Money0 leftmouseup')
else
if mq.TLO.Me.PlatinumShared() >= p_amount then
mq.cmd('/notify BigBankWnd BIGB_SharedMoney0 leftmouseup')
else
print("\ao[\atTCSNeXt\ao]: \ay[\awNot Enough Cash:\ay] \ap[\ag",
p_amount, "\ap] \atPlatinum \ay[\ayNeeded\ay]")
return false
end
end
print("\ao[\atTCSNeXt\ao]: \ay[\awGrabbing:\ay] \ap[\ag", p_amount,
"\ap] \atPlatinum \agfrom: \ay[\ayBank\ay]")
mq.delay(1000)
mq.cmd('/notify QuantityWnd QTYW_slider newvalue ' .. p_amount)
mq.delay(1000)
mq.cmd('/notify QuantityWnd QTYW_Accept_Button leftmouseup')
mq.delay(1000)
mq.cmd('/autoinv')
mq.delay(1000)
mq.cmd('/notify BigBankWnd BIGB_DoneButton leftmouseup')
mq.delay(1500)
return false
end
if mq.TLO.Me.Inventory(32)() ~= craft_container then
local item_type = {
"Baking", "Medicine", "Fletching", "Jewelry Making", "Mixing",
"Tinkering", "Make Poison", "Food", "Drink", "Misc", "Book",
"Combinable", "Lexicon", "Alchemy", "Shield", "Armor", "nil"
}
local swappable = 0
for x = 0, #item_type do
if mq.TLO.Me.Inventory(32).Type() ~= item_type[x] then
swappable = 1
mq.delay(100)
end
end
mq.delay(1500)
if swappable == 1 then
mq.cmd('/ctrl /itemnotify "' .. craft_container .. '" leftmouseup')
mq.delay(1500)
mq.cmd('/nomodkey /itemnotify 32 leftmouseup')
mq.delay(1000)
lib.ClearCursor()
end
lib.ClearCursor()
mq.delay(1000)
if swappable == 0 then
local move_slot = 0
for x = 23, 31 do
if mq.TLO.Me.Inventory(x)() == nil then
move_slot = x
end
end
if move_slot ~= 0 then
mq.cmd('/nomodkey /itemnotify 32 leftmouseup')
mq.delay(1000)
mq.cmd('/ctrl /itemnotify "' .. move_slot .. '" leftmouseup')
mq.delay(1000)
mq.cmd('/ctrl /itemnotify "' .. craft_container ..
'" leftmouseup')
mq.delay(1000)
mq.cmd('/ctrl /itemnotify 32 leftmouseup')
end
end
end
if mq.TLO.Me.Inventory(32)() ~= craft_container then
print(
"\at[TCSNeXt]\ay[We Failed Somehow to put the portable container in slot 32, Routine TCN_Craft]")
mq.exit()
end

function library.return_available_container(p_name)
local available_containers = {
"Deluxe Toolbox", "Planar Fletching Kit", "Reinforced Medicine Bag",
"Foldable Medicine Bag", "Marble Mortar and Pestle",
"Planar Jeweler's Kit", "Reinforced Jeweler's Kit"
}
for x = 1, #available_containers do
if string.match(available_containers[x], p_name) and
mq.TLO.FindItemCount(available_containers[x])() > 0 then
local m = available_containers[x]
return m
end
end
end
|Toolbox <> Swapper!
/if (${ContainerName.Equal[ToolBox]} && ${FindItemCount[=Deluxe Toolbox]} > 0) {
/varset ContainerName Deluxe Toolbox
}
|Fletching Kit <> Swapper!
/if (${ContainerName.Equal[Fletching Kit]} && ${FindItemCount[=Planar Fletching Kit]} > 0) {
/varset ContainerName Planar Fletching Kit
}
|Jewler's Kit <> Swapper!
/if (${ContainerName.Equal[Jeweler's Kit]} && (${FindItemCount[=Planar Jeweler's Kit]} > 0 || ${FindItemCount[=Reinforced Jeweler's Kit]} > 0)) {
/varset ContainerName ${FindItem[Jeweler's Kit]}
}
|Mortar and Pestle <> Swapper!
/if (${ContainerName.Equal[Mortar and Pestle]} && ${FindItemCount[=Marble Mortar and Pestle]} > 0) {
/varset ContainerName ${FindItem[Mortar and Pestle]}
}
|Medicine Bag <> Swapper!
/if (${ContainerName.Equal[Medicine Bag]} && (${FindItemCount[=Reinforced Medicine Bag]} > 0 || ${FindItemCount[=Foldable Medicine Bag]} > 0)) {
/varset ContainerName ${FindItem[Medicine Bag]}
}
Glad you're finding efficiencies to make the process work better. Out of curiosity, is there a reason to hard-code that list? Seems like making it an add-in lua file (e.g., containers.lua) is more maintainable long-term.
One of the idea of separate files is to improve maintainability. In this case, a list of portable tradeskill containers is a resource. So is a list of reusable tools (file, smithy hammer, etc.) or stationary tradeskill containers. Having them separated makes it easier for you to bring them up quickly for modification and reference. I made my comment because you had the list defined within a function. Even if that function were located in your library file, I'd still encourage moving the list of available containers out of the function. Personally, I'd move them to a resources file, but even if you didn't want to create another file those types of definitions having them together in your library is still beneficial.
You are following this basic idea now within the TSC macro system by having the different areas of concern (core, god, pok, support, etc.) as separate files. A good code editor can help mitigate the management of this data/info in many ways, but the idea still remains. Make it easier on your future self by using good practices now.
local mq = require('mq')
local mv = require('tcn_movement')
local lib = require('tcn_library')
local buy = require('tcn_buy')
local craft = require('tcn_craft')
local sqlite3 = require('lsqlite3complete')
local db = sqlite3.open('artisandb.db')
I guess I need SQL
I need to read more...
-- Search SQL Recipes
local function bind_search(...)
local args = {...}
if args[1] == nil then
print "invalid input "
return
end
mq.delay(1)
local clean_arg = string.gsub(args[1], '"', '')
if args[2] == "any" then
clean_arg = '%' .. clean_arg .. '%'
else
clean_arg = clean_arg .. '%'
end
clean_arg = "'" .. clean_arg .. "'"
search_recipes(clean_arg)
end

no, require caches. You load it once, it will reference the loaded object that was previous loaded. What you want is loadfile (which is kind of broken right now, it's on my list when I can get some time...)
I'm still holding strong for some of those "genius" momentsSix months from now you’ll look back and either think you were a genius or an idiot. There is no in between.
Usually when I go back to look at old code I've written it's "What the hell was I thinking to write it that way?!?"
|get /Call Get_Item_Total "${ts_file}" ${rec_tick}
|for 1 to 2 do these other things..
|get item name /Call Get_Item_Name "${ts_file}" ${rec_tick} ${item_num}
|/Call Get_ Item_Count "${ts_file}" ${rec_tick} ${item_num} get item count
|get item vendor |call item match


-- Main Turn IN Loop
for row in db:nrows(
"SELECT * FROM Quest_Table WHERE Quest_Step_Order =2 and Quest_Task_ID =" ..
p_quest_id) do
local deliver_item_req = mq.TLO.Task(p_quest_title).Objective(
row.Quest_Deliver_Step).RequiredCount()
local deliver_item_cur = mq.TLO.Task(p_quest_title).Objective(
row.Quest_Deliver_Step).CurrentCount()
local fv_item_count = mq.TLO.FindItemCount(row.Quest_Item_ID)()
if mq.TLO.Task(p_quest_title).Objective(row.Quest_Deliver_Step).Status() ~=
"Done" then
-- Items to turn in
if mq.TLO.FindItemCount(row.Quest_Item_ID)() > 0 then
local remaining_deliver_count = deliver_item_req -
deliver_item_cur
local fv_turn_in = remaining_deliver_count
if fv_item_count > remaining_deliver_count then
fv_turn_in = remaining_deliver_count
end
if fv_item_count ~= 0 and fv_item_count <
remaining_deliver_count then
fv_turn_in = fv_item_count
end
-- No-Stack
if mq.TLO.FindItem(row.Quest_Item_ID).StackSize() == 1 and
remaining_deliver_count > 0 then
-- Item Inventory
fv_item_count = mq.TLO.FindItemCount(row.Quest_Item_ID)()
for x = 1, fv_turn_in do
lib.give_quest_item_id(row.Quest_Item_ID, 1)
mq.delay(100)
end
else
-- Stacks
lib.give_quest_item_id(row.Quest_Item_ID, fv_turn_in)
mq.delay(100)
end
end
end
end
mq.delay(1)
end
Truly amazing work and really fun to watch your banter, keep up the good fight!YES! it is coming..
menu driven trophy quests based on your skill , race, class...
View attachment 33344
