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.
 Entire forum ➜ MUSHclient ➜ Plugins ➜ Who List Miniwindow

Who List Miniwindow

Posting of new messages is disabled at present.

Refresh page


Posted by Aralia Faal   (25 posts)  Bio
Date Sat 30 Jun 2012 06:12 PM (UTC)
Message
I'm trying to make a plugin for a mud I play that takes the who list:

Accessing CDI Information...
...
..Found!

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[ Immorts ]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[1004 RANK] |PK| Immortal Name
[1007 RANK] |PPK| Immortal Name

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[ Players ]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[1170 Aus] |PPK| Player Name

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[ Newbies ]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[ 2 Ara] Player Name
Visible Players: 3/3 Max since reboot: 9 Max Ever: 65

Logging off..
...
..Disconnected.

And makes two seperate miniwindows. One for Immortals and the one for Players, (which combines both Players and Newbies).

(RANK and Names edited due to offensive terms)
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Sat 30 Jun 2012 06:22 PM (UTC)
Message
So what do you have so far?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Aralia Faal   (25 posts)  Bio
Date Reply #2 on Sat 30 Jun 2012 06:53 PM (UTC)

Amended on Sat 30 Jun 2012 07:22 PM (UTC) by Aralia Faal

Message
Knew I forgot something. Its not exactly a plugin yet, I've tried converting the Inventory Miniwindow Plugin into an alias to capture all of it just to see if I could get it to work without making more then one miniwindow:

require "wait"

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


local win = GetPluginID () .. ":who"
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 who list

Send "who"


-- wait for who list to start

local x = wait.match ("..Found!", 10)

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

local inv = {}
local max_width = WindowTextWidth (win, font, "Who")

-- loop until end of who list

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

  -- see if end of who list

  if string.match (line, "^Logging off..") then
    break
  end -- if

  -- save who list 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 "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)

-- heading line

WindowText (win, font, "Who List", 5, 5, 0, 0, ColourNameToRGB  "yellow")

-- draw each who list 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 who list item

WindowShow (win, true)


end)   -- end of coroutine


10 seconds later I get "No Inventory received within 10 seconds"

I didn't edit much as you can see most of the functions still use inv. Once I get it working I'll end up changing them to whoImm or whoplayer.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 30 Jun 2012 11:13 PM (UTC)
Message
Aralia Faal said:



...
  ColourNote ("white", "blue", "No who list received within 10 seconds")
...


10 seconds later I get "No Inventory received within 10 seconds"



Oh? That message is not in the alias.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Aralia Faal   (25 posts)  Bio
Date Reply #4 on Sat 30 Jun 2012 11:34 PM (UTC)
Message
Oh.. that was my mistake it does return "No who list received within 10 seconds" I scrolled up to get it just to be sure and I must have gone up to a point before I edited it.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #5 on Sun 01 Jul 2012 07:09 AM (UTC)
Message
Can you double-click on the line with "Found!" on it, and then go to Display menu -> Text Attributes -> Line Info.

Then find the notepad window that will have opened underneath and copy and paste what you see? Like this:


Line 537 (537), Sunday, July 01, 5:07:20 PM
 Flags = End para: YES, Note: no, User input: no, Log: YES, Bookmark: no
 Length = 8, last space = -1
 Text = "..Found!"

1 style run

1: Offset = 0, Length = 8, Text = "..Found!"
 No action.
 Flags = Hilite: no, Underline: no, Blink: no, Inverse: no, Changed: no
 Foreground colour ANSI  : 7 (White)
 Background colour ANSI  : 0 (Black)

8 columns in 1 style run

------ (end line information) ------


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Aralia Faal   (25 posts)  Bio
Date Reply #6 on Sun 01 Jul 2012 11:16 AM (UTC)
Message
Line 108 (108), Sunday, July 01, 7:14:05 AM
 Flags = End para: YES, Note: no, User input: no, Log: YES, Bookmark: no
 Length = 8, last space = -1
 Text = "..Found!"

2 style runs

1: Offset = 0, Length = 2, Text = ".."
 No action.
 Flags = Hilite: YES, Underline: no, Blink: no, Inverse: no, Changed: no
 Foreground colour ANSI  : 5 (Magenta)
 Background colour ANSI  : 0 (Black)

2: Offset = 2, Length = 6, Text = "Found!"
 No action.
 Flags = Hilite: no, Underline: no, Blink: no, Inverse: no, Changed: no
 Foreground colour ANSI  : 5 (Magenta)
 Background colour ANSI  : 0 (Black)

8 columns in 2 style runs

------ (end line information) ------
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #7 on Sun 01 Jul 2012 09:31 PM (UTC)
Message
Hmmm. Can you now copy the actual alias please? Not just the contents of it.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Aralia Faal   (25 posts)  Bio
Date Reply #8 on Mon 02 Jul 2012 06:19 AM (UTC)
Message
<aliases>
  <alias
   match="who"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

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

local win = GetPluginID () .. ":who"
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 who list

Send "who"

  -- wait for who list to start
local x = wait.match ("..Found!", 10)

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

local inv = {}
local max_width = WindowTextWidth (win, font, "Who")

  -- loop until end of who list
while true do
  local line, wildcards, styles = wait.match ("*")

  -- see if end of who list
  if string.match (line, "^Logging off..") then
    break
  end -- if

  -- save who list 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 "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)

  -- heading line
WindowText (win, font, "Who List", 5, 5, 0, 0, ColourNameToRGB  "yellow")

  -- draw each who list 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 who list item

WindowShow (win, true)

end) -- end of coroutine</send>
  </alias>
</aliases>
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 02 Jul 2012 08:47 AM (UTC)

Amended on Mon 02 Jul 2012 08:50 AM (UTC) by Nick Gammon

Message
I can reproduce your problem. However it goes away if you put it back into a plugin (not totally sure why).

For the moment I suggest you take the original Inventory Miniwindow Plugin, change the name and plugin ID here:


<plugin
   name="Inventory_Miniwindow_Demo"
   author="Nick Gammon"
   id="e49156f49854904ea8b90223"
   language="Lua"
   purpose="Shows Inventory in a miniwindow"
   save_state="y"
   date_written="2010-05-02 15:35:51"
   requires="4.51"
   version="1.0"
   >


eg.


<plugin
   name="Who_List_Miniwindow"
   author="Aralia Faal"
   id="78999ac6f6dcbbeb7c2ce6e0"
   language="Lua"
   purpose="Shows Who List in a miniwindow"
   save_state="y"
   date_written="2012-07-02"
   requires="4.51"
   version="1.0"
   >





And then make the few other changes you had to the alias. It worked for me as a plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Aralia Faal   (25 posts)  Bio
Date Reply #10 on Mon 02 Jul 2012 05:29 PM (UTC)

Amended on Mon 02 Jul 2012 05:30 PM (UTC) by Aralia Faal

Message
I have to admit I'm not that.. "smart" when it comes to all this. I used the YouTube tutorials to create the alias. That being said.. How do I make it an actual plugin?
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #11 on Mon 02 Jul 2012 09:59 PM (UTC)
Message
You are right, it *should* work. And I just made a new empty world, pasted in your alias, and it worked. There must be something interfering with it.

For example, another trigger matching first.

Can you turn on Game menu -> Trace, and try the alias again? Paste what it shows. Thanks.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Aralia Faal   (25 posts)  Bio
Date Reply #12 on Tue 03 Jul 2012 12:52 AM (UTC)

Amended on Tue 03 Jul 2012 01:24 AM (UTC) by Aralia Faal

Message
The bad news:
I screwed something up because all my triggers and aliases disapeared...

The good news:
I copeid and pasted what I entered when you asked me to past the alias itself and it now works.

To do list:
I'd like to have it remove the display from the world.
Have it update when someone logs in and out
(GW:OM) Gibin Has Come To Play! 
(GW:OM) Gibin Decided To Rejoin The Real World.
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.


30,948 views.

Posting of new messages is disabled at present.

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.