house member miniconsole

Post Reply
nexa33
Posts: 14
Joined: Wed Oct 27, 2010 2:47 am

house member miniconsole

Post by nexa33 »

I have been trying to have mudlet keep a list of who is currently online for my house refreshed in a miniconsole. I have the miniconsole working but I can't figure out how to capture the list. Would it involve using a timer to send the hwho command and a regex pattern to send the output to the miniconsole? I am using achaea. Thanks.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: house member miniconsole

Post by tsuujin »

nexa33 wrote:I have been trying to have mudlet keep a list of who is currently online for my house refreshed in a miniconsole. I have the miniconsole working but I can't figure out how to capture the list. Would it involve using a timer to send the hwho command and a regex pattern to send the output to the miniconsole? I am using achaea. Thanks.
Basically, yes. You'd have to constantly refresh the list by sending HWHO, gagging and parsing the output and then displaying it on whatever console you wanted. You could also do things like a trigger for your house chat that automatically adds anyone who says anything, because they're obviously online.

I'd keep the members list as a table like:
Code: [show] | [select all] lua
houseMembers = {}
then when someone is registered
Code: [show] | [select all] lua
houseMembers["player_name"] = true
which means that whenever you resend the HWHO you can reset the table with a simple call to
Code: [show] | [select all] lua
houseMembers = {}
then just parse the list for your miniconsole with a for loop
Code: [show] | [select all] lua
for i,v in pairs(houseMembers) do 
   ...
end

nexa33
Posts: 14
Joined: Wed Oct 27, 2010 2:47 am

Re: house member miniconsole

Post by nexa33 »

Ok thanks, I will give that a try and see if that works. I was wondering if it would be easier to have it just parse the output from the "hwho" command since not all housemates will always say something. Would I just use a timer for that to have it issue the hwho command at a set interval?

nexa33
Posts: 14
Joined: Wed Oct 27, 2010 2:47 am

Re: house member miniconsole

Post by nexa33 »

Ok so I've got something similar to Vadi's Data Capture triggers. It captures the list and I figured out how to send it to the miniconsole.

Is there any way to delete the buffer once you run appendBuffer()?

Right now I have this:
Code: [show] | [select all] lua
selectString(line, 1);
copy();
appendBuffer("hwho");
deleteLine();
When there aren't a lot of lines for the list it just repeats itself again at the bottom so I get something like this:
Image

EDIT: Kind of fixed it. I changed the size of the miniconsole so it looks better now. My only worry is that if more members are online, it will get cutoff because the console isn't big enough. Any way to solve this?

Sunburn
Posts: 6
Joined: Mon Nov 15, 2010 11:13 am

Re: house member miniconsole

Post by Sunburn »

it will get cutoff because the console isn't big enough. Any way to solve this?
Count the number of lines you want to display and resize the height of the miniconsole? If they ever gets too large you can limit it by doing something like
if lines >= maxlines then echo "and others..."

Or maybe you could implement a second page like the tabbed chat example in the forums?

Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

Re: house member miniconsole

Post by Lucky24 »

You can also always just scroll a miniconsole by hovering over it and using the mouse scroll wheel to scroll up and down if there's too many lines to display (works just like the main window)

Post Reply