when watching vid 2, almost complete, i get the next error after it lists whats in my backpack:
in 3 colours :P pink, light orange dark orange but i don't know if i can use the colours here.
Error raised in trigger function (in wait module)
stack traceback:
[C]: in function 'WindowCreate'
[string "Alias: "]:56: in function <[string "Alias: "]:3>
Run-time error
World: Aardwolf
Function/Sub: wait.trigger_resume called by trigger
Reason: processing trigger "wait_trigger_885"
C:\Aardwolf\MUSHclient\lua\wait.lua:67: [string "Alias: "]:56: bad argument #5 to 'WindowCreate' (number expected, got nil)
stack traceback:
[C]: in function 'error'
C:\Aardwolf\MUSHclient\lua\wait.lua:67: in function <C:\Aardwolf\MUSHclient\lua\wait.lua:59>
and this is what's inside my alias
require "wait"
wait.make (function () -- coroutine starts here
local win = GetPluginID ( ) .. ":A Demon School Backpack"
local font = "f"
if not WindowInfo ( win, 1) then
WindowCreate (win, 0, 0, 0, 0, 6, 0, 0)
WindowFont (win, font, "Lucida Console", 9)
end -- if
-- request backpack
Send "look in backpack"
-- wait for backpack to start
local x = wait.match ("The demon school backpack contains:", 10)
if not x then
ColourNote ("white", "blue", "No backpack received within 10 seconds")
return
end -- if
local backpack = {}
local max_width = WindowTextWidth (win, font, "a demon school backpack")
-- loop until end of backpack
while true do
local line, wildcards, styles = wait.match ("*")
-- see if end of backpack
if not string.match (line, "^%([ %d]%d%) ") then
if not string.match (line, "^ ") then
break
end -- if
end -- if
--save backpack line
table.insert (backpack, 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_heith = font_height * (#backpack + 2) + 10
-- make window correct size
WindowCreate (win, 0, 0, window_width, window_height, 7, 0, ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- heading line
WindowText (win, font, "a Demon School Backpack", 5, 5, 0, 0, ColourNameToRGB (yellow))
-- draw each inventory line
local y = font_height * 2 + 5
for i, styles in pairs (backpack) 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_eight
end -- for each backpack item
WindowShow (win, true)
end) -- end of coroutine
|