How would I go about creating a trigger that sends my prompt into a miniwindow each time it pops up? I checked the inventory to miniwindow tutorial but I don't have a clue about how I would edit it to work as a trigger. I play Icesus and I've modified my prompt to look like this. I would like to send this to a miniwindow and omit it from the output.
Prompt start
HP = 727 / 727 100%
SP = 441 / 441 100%
EP = 664 / 664 100%
Fury = 0
EXP = 591699
to lvl = -128730
to adv = -556713
Money = 0
Time = night
Hour = Deepnight (1st)
Phase of magic
Prompt end
Update!
Got it to work by adding line "Stats" to the prompt and recalling that with the inventory miniwindow script.
require "wait"
wait.make (function () -- coroutine starts here
local win = GetPluginID () .. ":inventory"
local font = "f"
if not WindowInfo (win, 1) then
WindowCreate (win, 0, 0, 0, 0, 6, 0, 0)
WindowFont (win, font, "Consolas", 14)
end -- if
-- request inventory
-- wait for inventory to start
local x = wait.match ("Stats", 10, trigger_flag.OmitFromOutput)
if not x then
ColourNote ("white", "blue", "No inventory received within 10 seconds")
return
end -- if
local inv = {}
local max_width = WindowTextWidth (win, font, "Inventory")
-- loop until end of inventory
while true do
local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)
-- see if end of inventory
if string.match (line, "Prompt end") then
break
end -- if
-- save inventory line
table.insert (inv, styles)
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
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, 6, 0, ColourNameToRGB "black")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- heading line
WindowText (win, font, "Stats", 5, 5, 0, 0, ColourNameToRGB "white")
-- draw each inventory 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 inventory item
WindowShow (win, true)
end) -- end of coroutine
Update 2! Realized I didn't actually need the stats line in the prompt since I was already starting the matching with the trigger so I ended up with a slightly shorter code.
require "wait"
wait.make (function () -- coroutine starts here
local win = GetPluginID () .. ":prompt"
local font = "f"
if not WindowInfo (win, 1) then
WindowCreate (win, 0, 0, 0, 0, 4, 0, 0)
WindowFont (win, font, "Consolas", 9)
end -- if
-- request prompt
local inv = {}
local max_width = WindowTextWidth (win, font, "Inventory")
-- loop until end of prompt
while true do
local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)
-- see if end of prompt
if string.match (line, "Prompt end") then
break
end -- if
-- save inventory line
table.insert (inv, styles)
end -- while loop
local font_height = WindowFontInfo (win, font, 1)
local window_width = 290
local window_height = 305
-- make window correct size
WindowCreate (win, 850, 0, window_width, window_height, 0, 2, ColourNameToRGB "black")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- draw each inventory line
local y = 10
for i, styles in ipairs (inv) do
local x = 10
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 inventory item
WindowShow (win, true)
end) -- end of coroutine
|