Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ Miniwindows for Awakened Worlds

Miniwindows for Awakened Worlds

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2  3 

Posted by Crashdivide   USA  (22 posts)  Bio
Date Reply #30 on Thu 08 Jul 2010 07:35 AM (UTC)
Message
Nevermind, I seem to have figured it all out. To create spaces in the window, is that just extra lines in the code? Or is there a tag to create link breaks?

AwakenedWorlds.net Port:4000
Top

Posted by Crashdivide   USA  (22 posts)  Bio
Date Reply #31 on Thu 08 Jul 2010 07:38 AM (UTC)
Message
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, "Lucida Console", 9)
end -- if

-- request inventory

Send "inventory"


-- wait for inventory to start

local x = wait.match ("*You are carrying:", 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 line == "" 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

-- request inventory

Send "look in pack"


-- wait for inventory to start

local x = wait.match ("*a Blackwind(tm) R-55 M.O.R.P (used): ", 10, trigger_flag.OmitFromOutput)

if not x then
ColourNote ("white", "blue", "No inventory received within 10 seconds")
return
end -- if

local pack = {}
local max_width = WindowTextWidth (win, font, "a Blackwind(tm) R-55 M.O.R.P")



-- loop until end of inventory

while true do
local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)

-- see if end of inventory

if line == "" then
break
end -- if

-- save inventory line
table.insert (pack, 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 + #pack + 2) + 10

-- make window correct size

WindowCreate (win, 0, 0, window_width, window_height, 6, 0, ColourNameToRGB "#000000")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText (win, font, "Inventory", 5, 5, 0, 0, ColourNameToRGB "red")

-- 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

-- heading line

WindowText (win, font, "a Blackwind(tm) R-55 M.O.R.P", 5, y, 0, 0, ColourNameToRGB "Red")

y = y + font_height


-- draw each inventory line

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



This makes the window:

Inventory

Item
Item
Item
Item
Blackwind
Item
Item
Item


Just need to figure out how to space, since it seems that the Inventory group and the Blackwind group are identical, yet there's only a space after inventory.

AwakenedWorlds.net Port:4000
Top

Posted by Crashdivide   USA  (22 posts)  Bio
Date Reply #32 on Thu 08 Jul 2010 08:49 AM (UTC)
Message
I decided, instead, to go with the two windows, and this is what I used:


require "wait"

wait.make (function ()  -- coroutine starts here


local win = GetPluginID () .. ":inventory"
local font = "f"

if not WindowInfo ("1", 1) then
  WindowCreate ("1", 0, 0, 0, 0, 6, 0, 0)
  WindowFont ("1", font, "Lucida Console", 9)
end -- if

-- request inventory

Send "inventory"


-- wait for inventory to start

local x = wait.match ("*You are carrying:", 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 ("1", 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 line == "" then
    break
  end -- if

  -- save inventory line
  table.insert (inv, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth ("1", font, line))

end -- while loop


local font_height = WindowFontInfo ("1", font, 1)

local window_width = max_width + 10
local window_height = font_height * (#inv + 2) + 10

-- make window correct size

WindowCreate ("1", 0, 0, window_width, window_height, 6, 0, ColourNameToRGB "#000000")
WindowRectOp ("1", 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText ("1", font, "Inventory", 5, 5, 0, 0, ColourNameToRGB  "red")

-- 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 ("1", font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_height

end -- for each inventory item


if not WindowInfo ("2", 1) then
  WindowCreate ("2", 0, 0, 0, 0, 7, 0, 0)
  WindowFont ("2", font, "Lucida Console", 9)
end -- if


-- request inventory

Send "look in pack"


-- wait for inventory to start

local x = wait.match ("*a Blackwind(tm) R-55 M.O.R.P (used): ", 10, trigger_flag.OmitFromOutput)

if not x then
  ColourNote ("white", "blue", "No inventory received within 10 seconds")
  return
end -- if

local pack = {}
local max_width = WindowTextWidth ("2", font, "a Blackwind(tm) R-55 M.O.R.P")

-- loop until end of inventory

while true do
  local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)

  -- see if end of inventory

  if line == "" then
    break
  end -- if

  -- save inventory line
  table.insert (pack, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth ("2", font, line))

end -- while loop

local font_height = WindowFontInfo ("2", font, 1)

local window_width = max_width + 10
local window_height = font_height * (#pack + 2) + 10

-- make window correct size

WindowCreate ("2", 0, 0, window_width, window_height, 7, 0, ColourNameToRGB "#000000")
WindowRectOp ("2", 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText ("2", font, "a Blackwind(tm) R-55 M.O.R.P", 5, 5, 0, 0, ColourNameToRGB  "Red")

-- draw each inventory line

local y = font_height * 2 + 5

for i, styles in ipairs (pack) do

  local x = 5
  for _, style in ipairs (styles) do
    x = x + WindowText ("2", font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_height

end -- for each inventory item

WindowShow "1"
WindowShow "2"


end)   -- end of coroutine



This works great, but I want to get the second window, which is in the 7 position, right under the first window, in the 6 position. But if I set them both to 6, they overlap.

AwakenedWorlds.net Port:4000
Top

Posted by Crashdivide   USA  (22 posts)  Bio
Date Reply #33 on Fri 09 Jul 2010 09:31 AM (UTC)
Message
Everything seems to be working great now, I even added a few more windows, but, I have one question.

I have a window for the inventory, the pack, and spells I'm sustaining. But if there's nothing in the pack, or I'm not carrying anything, or not sustaining spells, none of the windows work until I put something in inv/pack/sustain a spell. Is there a way to fix that?


I'm using:


require "wait"

wait.make (function ()  -- coroutine starts here


local win = GetPluginID () .. ":inventory"
local font = "f"

if not WindowInfo ("1", 1) then
  WindowCreate ("1", 0, 0, 0, 0, 6, 0, 0)
  WindowFont ("1", font, "Lucida Console", 9)
end -- if

-- request inventory

Send "inventory"


-- wait for inventory to start

local x = wait.match ("*You are carrying:", 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 ("1", 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 line == "" then
    break
  end -- if

  -- save inventory line
  table.insert (inv, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth ("1", font, line))

end -- while loop


local font_height = WindowFontInfo ("1", font, 1)

local window_width = max_width + 10
local window_height = font_height * (#inv + 2) + 10

-- make window correct size

WindowCreate ("1", 0, 0, window_width, window_height, 6, 0, ColourNameToRGB "#000000")
WindowRectOp ("1", 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText ("1", font, "Inventory", 5, 5, 0, 0, ColourNameToRGB  "red")

-- 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 ("1", font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_height

end -- for each inventory item


if not WindowInfo ("2", 1) then
  WindowCreate ("2", 0, 0, 0, 0, 7, 0, 0)
  WindowFont ("2", font, "Lucida Console", 9)
end -- if


-- request inventory

Send "look in pack"


-- wait for inventory to start

local x = wait.match ("*a Blackhawk(TM) X-3 R.A.P.T.O.R. pack (used): ", 10, trigger_flag.OmitFromOutput)

if not x then
  ColourNote ("white", "blue", "No inventory received within 10 seconds")
  return
end -- if

local pack = {}
local max_width = WindowTextWidth ("2", font, "a Blackhawk(TM) X-3 R.A.P.T.O.R.")

-- loop until end of inventory

while true do
  local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)

  -- see if end of inventory

  if line == "" then
    break
  end -- if

  -- save inventory line
  table.insert (pack, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth ("2", font, line))

end -- while loop

local font_height = WindowFontInfo ("2", font, 1)

local window_width = max_width + 10
local window_height = font_height * (#pack + 2) + 10

-- make window correct size

WindowCreate ("2", 0, 0, window_width, window_height, 7, 0, ColourNameToRGB "#000000")
WindowRectOp ("2", 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText ("2", font, "a Blackhawk(TM) X-3 R.A.P.T.O.R. pack", 5, 5, 0, 0, ColourNameToRGB  "Red")

-- draw each inventory line

local y = font_height * 2 + 5

for i, styles in ipairs (pack) do

  local x = 5
  for _, style in ipairs (styles) do
    x = x + WindowText ("2", font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_height

end -- for each inventory item

if not WindowInfo ("3", 1) then
  WindowCreate ("3", 0, 0, 0, 0, 7, 0, 0)
  WindowFont ("3", font, "Lucida Console", 9)
end -- if

-- request inventory

Send "status"


-- wait for inventory to start

local x = wait.match ("*You are sustaining:", 10, trigger_flag.OmitFromOutput)

if not x then
  ColourNote ("white", "blue", "No inventory received within 10 seconds")
  return
end -- if

local sus = {}
local max_width = WindowTextWidth ("3", font, "Sustained Spells")

-- loop until end of inventory

while true do
  local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)

  -- see if end of inventory

  if line == "" then
    break
  end -- if

  -- save inventory line
  table.insert (sus, styles)
  -- work out max width
  max_width = math.max (max_width, WindowTextWidth ("3", font, line))

end -- while loop


local font_height = WindowFontInfo ("3", font, 1)

local window_width = max_width + 10
local window_height = font_height * (#sus + 2) + 10

-- make window correct size

WindowCreate ("3", 0, 0, window_width, window_height, 7, 0, ColourNameToRGB "#000000")
WindowRectOp ("3", 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText ("3", font, "Sustained Spells", 5, 5, 0, 0, ColourNameToRGB  "red")

-- draw each inventory line

local y = font_height * 2 + 5

for i, styles in ipairs (sus) do

  local x = 5
  for _, style in ipairs (styles) do
    x = x + WindowText ("3", font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_height

end -- for each inventory item

WindowShow "1"
WindowShow "2"
WindowShow "3"

end)   -- end of coroutine

AwakenedWorlds.net Port:4000
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


81,039 views.

This is page 3, subject is 3 pages long:  [Previous page]  1  2  3 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.