I've been researching this for days, and driving myself up a wall, but I'm not a coder and I can't hit upon the magic to make it work as I'd like.
What I want: a mini window to open on my client, with a triggered grab of my quest information.
That's it. Ideally it would perform very similar to the Aardwolf Quest Noter plugin (https://www.gammon.com.au/forum/?id=8814) by Nick, but only in terms of the cute mini window opening on my screen. I want none of the complicated timer stuff, just the information displayed.
The block of text I need to capture is below, with * as the notator for information that changes:
You ask * for a quest.
* says 'Thank you, brave *!'
You have asked to find a lost item.
* says 'Vile thieves have stolen * from the royal treasury!'
* says 'My court wizardess, with her magic mirror, has pinpointed its location.'
* says 'Look in the general vicinity of * for *!'
It doesn't even need the whole block. Just what the thieves have stolen and looking in the vicinity of * for *.
I don't know if this is possible, I just know I have no idea how to make it so if it is.
Is this for Aardwolf? If it is then my answer will be different than if it isn't because I have premade modules for making miniwindows but they're tightly integrated with the Aardwolf MUSHclient package.
I've gone through it and all I can figure out is that it confuses the F out of me. I'm not sure exactly what to change to alter it to the key phrases I need.
Would it even still be a plugin? Can I do it with triggers only?
The trigger portion I can remove everything and add the ones I want, which is -- near as I can tell - the following:
<trigger
match="* says 'Vile thieves have stolen * from the royal treasury!'"
name="questor_line"
script="questor_line"
sequence="100"
expand_variables="y"
>
</trigger>
<trigger
enabled="y"
match="You ask * for a quest."
script="start_questor_stuff"
sequence="100"
>
</trigger>
<trigger
match="* says 'Look in the general vicinity of * for *!"
name="questor_end"
script="questor_end"
sequence="10"
expand_variables="y"
>
</trigger>
From there I'm not sure what to edit/remove/add/change in the script portion.
I'm a hot mess when it comes to code.
EDIT TO ADD: Probably not that either, because then how would it know to trigger only on MY quests and not other people's.
That covers, in some depth, capturing your inventory and showing it in a miniwindow.
Now, capturing quest information is the same concept, except that the words surrounding it will be different. So in your case "You ask * for a quest." could be what starts the capturing process off, and something else (like a prompt) would finish it.
That covers, in some depth, capturing your inventory and showing it in a miniwindow.
Now, capturing quest information is the same concept, except that the words surrounding it will be different. So in your case "You ask * for a quest." could be what starts the capturing process off, and something else (like a prompt) would finish it.
I can't even see how you would change what that tutorial is building (an alias with the wait function and all that) into something that captures text, as a trigger.
Unfortunately, it seems to be you're driving a Masterati while I'm still getting the hang of how any car drives. LOL
I know how to make a trigger. I know I want to use the following:
1.) * says 'Vile thieves have stolen * from the royal treasury!'
2.) * says 'Look in the general vicinity of * for *!'
I know (think I know) that * is a variable for information.
That's about where I get lost. It seems like this is way too far over my head to attempt.
function quest_handed_in (name, line, wildcards)
Send "pq time"
next_quest_time = os.time () + (30 * 60) -- 30 mins to go
quest_info = {}
show_quest_text ()
end -- quest_handed_in
function quest_time_to_go (name, line, wildcards)
local mins = tonumber (wildcards [1])
if mins then
next_quest_time = os.time () + mins * 60
else
next_quest_time = nil
end -- if
quest_info = {}
show_quest_text ()
end -- quest_time_to_go
function quest_available (name, line, wildcards)
next_quest_time = os.time ()
quest_info = {}
show_quest_text ()
end -- quest_available
function quest_done (name, line, wildcards)
quest_info = { "Quest complete - go hand it in." }
max_width = WindowTextWidth (win, font_id, quest_info [1])
show_quest_text ()
end -- quest_done
if time_to_go <= 0 then
text = "You are not currently on a quest!"
else
text = string.format ("Time until next quest: %s", convert_time (time_to_go))
end -- if
max_width = WindowTextWidth (win, font_id, text)
-- recreate the window the correct size
WindowCreate (win,
0, 0, -- left, top (auto-positions)
max_width + 10, -- width
font_height + 5, -- height
7, -- auto-position: top middle
0, -- flags
0xE7FFFF)
Display_Line (1, text, font_id, time_colour)
WindowShow (win, true)
end -- show_when_quest_available
function show_quest_text ()
if #quest_info == 0 and
next_quest_time then
show_when_quest_available ()
return
end -- one available now/soon
-- do nothing if no quest
if #quest_info == 0 or when_required == nil then
return
end -- if
-- recreate the window the correct size
WindowCreate (win,
0, 0, -- left, top (auto-positions)
max_width + 10, -- width
(#quest_info + 2) * font_height + 5, -- height
7, -- auto-position: top middle
0, -- flags
0xE7FFFF)
-- heading
local text = "Current quest."
Display_Line (1, text, font_id, heading_colour)
-- list of mobs
for i, v in ipairs (quest_info) do
Display_Line (i + 1, v, font_id, text_colour)
end -- for
-- how long to go
local time_to_go = when_required - os.time ()
if time_to_go < 0 then
return
end -- if
text = string.format ("Time to go: %s", convert_time (time_to_go))
Display_Line (#quest_info + 2, text, font_id, time_colour)
WindowShow (win, true)
end -- show_quest_text
function questor_end (name, line, wildcards)
local text = wildcards [1]
-- work out when quest ends
when_required = os.time ()
local days = string.match (text, "(%d+) days?")
if days then
when_required = when_required + tonumber (days) * 60 * 60 * 24
end -- some days left
local hours = string.match (text, "(%d+) hours?")
if hours then
when_required = when_required + tonumber (hours) * 60 * 60
end -- some days left
local minutes = string.match (text, "(%d+) minutes?")
if minutes then
when_required = when_required + tonumber (minutes) * 60
end -- some days left
if GetVariable ("enabled") == "false" then
ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
check (EnablePlugin(GetPluginID (), false))
return
end -- they didn't enable us last time
end -- OnPluginInstall
function OnPluginDisable ()
WindowShow (win, false)
end -- OnPluginDisable
All that looks rather complex. My tutorial, adapted slightly, is much easier to follow. Make a single trigger, as below (you don't need a plugin, however you could put the trigger in a plugin if you wanted):
<triggers>
<trigger
enabled="y"
match="You have asked to find a lost item."
send_to="12"
sequence="100"
>
<send>
require "wait"
wait.make (function () -- coroutine starts here
local win = GetPluginID () .. "_quest"
local font = "f"
if not WindowInfo (win, 1) then
WindowCreate (win, 0, 0, 0, 0, miniwin.pos_top_right, 0, 0)
WindowFont (win, font, "Lucida Console", 9)
end -- if
local inv = {}
local max_width = WindowTextWidth (win, font, "Current quest")
-- loop until end of quest info
while true do
local line, wildcards, styles = wait.match ("*")
-- save quest line
table.insert (inv, styles)
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
-- see if end of quest instructions
if string.match (line, "says 'Look in the general vicinity of") then
break
end -- if
end -- while loop
local font_height = WindowFontInfo (win, font, 1)
local window_width = max_width + 10
local window_height = font_height * (#inv + 2) + 10
-- make window correct size
WindowCreate (win, 0, 0, window_width, window_height, miniwin.pos_top_right, 0, ColourNameToRGB "#373737")
WindowRectOp (win, miniwin.rect_draw_edge, 0, 0, 0, 0,
miniwin.rect_edge_raised, miniwin.rect_edge_at_all + miniwin.rect_option_softer_buttons)
-- heading line
WindowText (win, font, "Current quest", 5, 5, 0, 0, ColourNameToRGB "yellow")
-- draw each quest line
local y = font_height * 2 + 5
for i, styles in ipairs (inv) do
local x = 5
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
end -- for
y = y + font_height
end -- for each quest item
WindowShow (win, true)
end) -- end of coroutine
</send>
</trigger>
</triggers>
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
I tested with the following text:
You have asked to find a lost item.
Nick says 'Vile thieves have stolen a widget from the royal treasury!'
Nick says 'My court wizardess, with her magic mirror, has pinpointed its location.'
Nick says 'Look in the general vicinity of the pond for a widget !'
The quest appeared in a miniwindow in the top RH corner, as expected.
To get rid of it (eg. when you have done the quest) you can add an alias:
YAY! This is fantastic! Thank you so much for your assistance!
I spent a lot of time futzing around and trying to make different things work. Lots of Googling and lots of searching these forums to figure out what I was missing and the information I needed.