@ -89,7 +89,7 @@ dbot.version : Module to track version and changelog information and update the
save_state="y"
save_state="y"
date_written="2017-08-12 08:45:15"
date_written="2017-08-12 08:45:15"
requires="4.98"
requires="4.98"
version="2.0040 "
version="2.0041 "
>
>
<description trim= "y" >
<description trim= "y" >
< ![CDATA[
< ![CDATA[
@ -650,6 +650,26 @@ Feature Wishlist
>
>
</alias>
</alias>
<alias
script="inv.cli.autoQueue.fn1"
match="^[ ]*dinv[ ]+auto[ ]+(halt)[ ]*$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
<alias
script="inv.cli.autoQueue.fn2"
match="^[ ]*dinv[ ]+auto[ ]+([0-9]+)[ ]+([0-9]+)[ ]+([0-9]+)[ ]+([0-9]+)[ ]+(.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
</aliases>
</aliases>
<!-- Script -->
<!-- Script -->
@ -816,11 +836,13 @@ end -- OnPluginDisconnect
function OnPluginEnable()
function OnPluginEnable()
dbot.debug("OnPluginEnable!")
dbot.debug("OnPluginEnable!")
dbot.info("@GENABLED@W")
end -- OnPluginEnable
end -- OnPluginEnable
function OnPluginDisable()
function OnPluginDisable()
dbot.debug("OnPluginDisable!")
dbot.debug("OnPluginDisable!")
dbot.info("@RDISABLED@W: You may type \"invmon\" to disable invmon tags if you no longer need them.")
end -- OnPluginDisable
end -- OnPluginDisable
@ -1641,6 +1663,8 @@ end -- inv.config.new
-- inv.cli.help.usage()
-- inv.cli.help.usage()
-- inv.cli.help.examples()
-- inv.cli.help.examples()
--
--
-- inv.cli.autoQueue.fn(name, line, wildcards)
--
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
inv.cli = {}
inv.cli = {}
@ -4930,6 +4954,32 @@ Examples:
end -- inv.cli.help.examples
end -- inv.cli.help.examples
inv.cli.autoQueue = {}
function inv.cli.autoQueue.fn1(name, line, wildcards)
dbot.autoQueueEnable = false
dbot.note("Auto Queue: halting...")
end -- inv.cli.autoQueue.fn1
function inv.cli.autoQueue.fn2(name, line, wildcards)
local maxCmds = wildcards[1] or ""
local cmdTimeout = wildcards[2] or ""
local totTimeout = wildcards[3] or ""
local state = wildcards[4] or ""
local command = wildcards[5] or ""
local paramStr = (command or "none") .. ", maxCommands=" .. (maxCmds or "nil")
local endTag = inv.tags.new(paramStr, nil, nil, nil)
dbot.debug("Auto Queue: cmd=\"" .. command .. "\", maxCmds=" .. maxCmds .. ", cmdTO=" .. cmdTimeout ..
", totTO=" .. totTimeout .. ", state=" .. state)
local retval = dbot.autoQueue(command, maxCmds, cmdTimeout, totTimeout, state, endTag)
return retval
end -- inv.cli.autoQueue.fn2
inv.cli.debug = {}
inv.cli.debug = {}
function inv.cli.debug.fn(name, line, wildcards)
function inv.cli.debug.fn(name, line, wildcards)
local command = wildcards[1] or ""
local command = wildcards[1] or ""
@ -7488,6 +7538,13 @@ function inv.items.storeCR()
local numItemsMoved = 0
local numItemsMoved = 0
for _,objId in ipairs(idArray) do
for _,objId in ipairs(idArray) do
-- Check the object's location. We don't want to store it if it is already in a container
if (tonumber(inv.items.getField(objId, invFieldObjLoc) or "") ~= nil) then
dbot.debug("Skipping store request for objId " .. objId .. ": it is already in a container")
else
-- The item isn't already in a container so we can store it
retval = inv.items.storeItem(objId, commandArray)
retval = inv.items.storeItem(objId, commandArray)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
dbot.note("Skipping request to store item " .. objId .. ": " .. dbot.retval.getString(retval))
dbot.note("Skipping request to store item " .. objId .. ": " .. dbot.retval.getString(retval))
@ -7505,6 +7562,7 @@ function inv.items.storeCR()
commandArray = dbot.execute.new()
commandArray = dbot.execute.new()
end -- if
end -- if
end -- if
end -- if
end -- if
end -- for
end -- for
-- Flush any commands in the array that still need to be sent to the mud
-- Flush any commands in the array that still need to be sent to the mud
@ -12103,13 +12161,30 @@ function inv.priority.tableToString(priorityTable, doDisplayUnused, doDisplayCol
local fieldDesc = fieldEntry[2]
local fieldDesc = fieldEntry[2]
local useField = true
local useField = true
-- This is a kludge. All priority weighting field names are lower case except
-- "offhandDam". When we added support for case insensitivity, that could cause a problem
-- for people with old priorities with "offhandDam" instead of "offhanddam". Here is a
-- one-off to work around that case by handling that one field differently.
if (fieldName == "offhanddam") then
fieldName = "offhandDam"
end -- if
-- Check if we should display this field or not. We only use the field if at least one entry
-- Check if we should display this field or not. We only use the field if at least one entry
-- block has a non-zero entry for the field or if the doDisplayUnused param is true.
-- block has a non-zero entry for the field or if the doDisplayUnused param is true.
if (not doDisplayUnused) then
if (not doDisplayUnused) then
useField = false
useField = false
for _, blockEntry in ipairs(priorityTable) do
for _, blockEntry in ipairs(priorityTable) do
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "") or 0
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "")
if (fieldName == "offhandDam") and (fieldValue == nil) then
fieldValue = tonumber(blockEntry.priorities["offhanddam"] or "")
end -- if
if (fieldValue == nil) then
fieldValue = 0
end -- if
if (fieldValue ~= 0) then
if (fieldValue ~= 0) then
useField = true
useField = true
@ -12122,7 +12197,16 @@ function inv.priority.tableToString(priorityTable, doDisplayUnused, doDisplayCol
priString = priString .. fieldPrefix .. string.format("\r\n%12s", fieldName) .. fieldSuffix
priString = priString .. fieldPrefix .. string.format("\r\n%12s", fieldName) .. fieldSuffix
for _, blockEntry in ipairs(priorityTable) do
for _, blockEntry in ipairs(priorityTable) do
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "") or 0
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "")
if (fieldName == "offhandDam") and (fieldValue == nil) then
fieldValue = tonumber(blockEntry.priorities["offhanddam"] or "")
end -- if
if (fieldValue == nil) then
fieldValue = 0
end -- if
local valuePrefix, valueSuffix = "", ""
local valuePrefix, valueSuffix = "", ""
if doDisplayColors then
if doDisplayColors then
@ -16784,6 +16868,7 @@ invTagsForget = "forget"
invTagsNotify = "notify"
invTagsNotify = "notify"
invTagsCache = "cache"
invTagsCache = "cache"
invTagsVersion = "version"
invTagsVersion = "version"
invTagsAutoQueue = "autoQueue"
invTagsHelp = "help"
invTagsHelp = "help"
inv.tags.modules = invTagsBuild .. " " ..
inv.tags.modules = invTagsBuild .. " " ..
@ -16807,6 +16892,7 @@ inv.tags.modules = invTagsBuild .. " " ..
invTagsNotify .. " " ..
invTagsNotify .. " " ..
invTagsCache .. " " ..
invTagsCache .. " " ..
invTagsVersion .. " " ..
invTagsVersion .. " " ..
invTagsAutoQueue .. " " ..
invTagsHelp
invTagsHelp
@ -17702,7 +17788,7 @@ function inv.consume.use(typeName, size, numItems, containerName)
return DRL_RET_SUCCESS
return DRL_RET_SUCCESS
end -- inv.consume.use
end -- inv.consume.use
drlConsumeMaxConsecutiveItems = 4
drlConsumeMaxConsecutiveItems = 10
function inv.consume.useCR()
function inv.consume.useCR()
local retval = DRL_RET_SUCCESS
local retval = DRL_RET_SUCCESS
local objId
local objId
@ -22191,6 +22277,86 @@ function dbot.version.update.releaseCR()
end -- dbot.version.update.releaseCR
end -- dbot.version.update.releaseCR
dbot.autoQueueEnable = true
dbot.autoQueuePkg = nil
function dbot.autoQueue(command, maxCommands, commandTimeout, totalTimeout, state, endTag)
local numMaxCommands = tonumber(maxCommands or "")
local numCommandTimeout = tonumber(commandTimeout or "")
local numTotalTimeout = tonumber(totalTimeout or "")
if (command == nil) or (numMaxCommands == nil) or (numCommandTimeout == nil) or (numTotalTimeout == nil) then
dbot.warn("dbot.autoQueue: Invalid parameters")
return inv.tags.stop(invTagsAutoQueue, endTag, DRL_RET_INVALID_PARAM)
end -- if
if (dbot.autoQueuePkg ~= nil) then
dbot.info("Skipping autoQueue request: another request is in progress")
return inv.tags.stop(invTagsAutoQueue, endTag, DRL_RET_BUSY)
end -- if
dbot.autoQueuePkg = {}
dbot.autoQueuePkg.command = command
dbot.autoQueuePkg.maxCommands = numMaxCommands
dbot.autoQueuePkg.commandTimeout = numCommandTimeout
dbot.autoQueuePkg.totalTimeout = numTotalTimeout
dbot.autoQueuePkg.state = state
dbot.autoQueuePkg.endTag = endTag
dbot.autoQueueEnable = true
wait.make(dbot.autoQueueCR)
return DRL_RET_SUCCESS
end -- drlAutoQueue
dbot.autoQueueFence = "Fence: auto queue"
dbot.autoQueueFenceIdx = 1
function dbot.autoQueueCR()
if (dbot.autoQueuePkg == nil) then
dbot.warn("dbot.autoQueueCR: package is nil!?!")
return DRL_INTERNAL_ERROR
end -- if
local retval = DRL_RET_SUCCESS
local endTag = dbot.autoQueuePkg.endTag
local startTime = dbot.getTime()
local numCmds = 1
dbot.debug("Running up to " .. dbot.autoQueuePkg.maxCommands .. " instances of \"" ..
dbot.autoQueuePkg.command .. "\", timeouts=" .. dbot.autoQueuePkg.commandTimeout ..
"/" .. dbot.autoQueuePkg.totalTimeout)
while (dbot.autoQueueEnable == true) do
local fence = dbot.autoQueueFence .. " " .. dbot.autoQueueFenceIdx
dbot.autoQueueFenceIdx = dbot.autoQueueFenceIdx + 1
check (Execute(dbot.autoQueuePkg.command))
check (Execute("echo " .. fence))
local line, wildcards = wait.regexp("^" .. fence .. "$",
dbot.autoQueuePkg.commandTimeout,
trigger_flag.OmitFromOutput)
if (line == nil) or
(line == "") or
(numCmds >= dbot.autoQueuePkg.maxCommands) or
(dbot.getTime() - startTime > dbot.autoQueuePkg.totalTimeout) or
(dbot.gmcp.getState() ~= dbot.autoQueuePkg.state) then
break
end -- if
dbot.info("@YAuto Queue: \"" .. dbot.autoQueuePkg.command .. "\" " .. numCmds .. "/" ..
dbot.autoQueuePkg.maxCommands)
numCmds = numCmds + 1
end -- while
dbot.autoQueuePkg = nil
return inv.tags.stop(invTagsAutoQueue, endTag, retval)
end -- dbot.autoQueueCR
]]>
]]>
</script>
</script>