[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Wrapping to X characters? Simple. Window width? Owwies.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Wrapping to X characters? Simple. Window width? Owwies.

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


Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Fri 16 Feb 2007 03:17 PM (UTC)
Message
I've been playing with the options that mushclient presents, especially the Wrapping options in Configuration>Output. The things listed there are very useful, but it is lacking one thing: usability.

SetOption offers the method to set most options if you cross reference their names with the MCL file. All fine and dandy. But at times, you do different things and you would like to resize the window. To do so, you resize, go Game>Configure>Output, click "Adjust width to size" and press OK. Tada, done. Even though the options dialog doesn't count all my lines anymore, it is still pretty annoying to have to go into the configuration for something so trivial.

So how about making it scriptable?

GetInfo(239) - Returns the amount of characters "Adjust width to size" would change the setting to. Using GetOption this could actually be set in the world.
GetInfo(240) - Not sure on this one. "Adjust size to width" actually changes the window size and all that, so if mush doesn't already have a function for this, make it return the amount of visible characters per row? I don't need this but it seems logical since there's two buttons in the configuration in the first place.

Thanks!
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #1 on Fri 16 Feb 2007 07:39 PM (UTC)
Message
Hmm. I have to agree. There could be situations where you resize the window, either manually or through script and you may need to adjust the spacing or layout of your script generated displays to "fit" that new sizes number of actual columns. Without some way to figure out exactly how many characters that is...

You couldn't, for example, do this:

setworldwindowstate (maximize)

OnPluginMainResize
  note "Columns: " & getinfo(blah)
end


Then use the mouse to drag the main window until the world window had exactly 90 columns. Heck, you can't even, currently, set the world window to dock (maximize) with the main one, then adjust the main one until the right number of columns are reached. Not without *guessing* based on some prediction of how big a column "should" be, based on the font size (which isn't that easy).

And you can't do:

MyDisplay (a, b, c)
  for x = 1 to numitems
    if getinfo (blah) < 90 then
      tell left(itemnames(x), getinfo(blah) - 60)
    else
      tell left(itemnames(x), 30)
    end if 
  ...


So, yeah, this is a good idea. But, imho, I would add a "maximize", "minimize" and "restore" option for the world windows as well, as per the first example, since that is missing and "moveworldwindow" can't perform that trick.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 17 Feb 2007 06:11 AM (UTC)
Message
One of the reasons MUSHclient is so fast in outputting text is that it assumes you do not constantly resize the window, and makes not attempt to retrospectively rewrap earlier text, even if you adjust the wrap column.

To be fair, many MUDs are designed around fixed 80-column text, so the drawbacks you describe are really theoretical, rather than practical.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #3 on Sat 17 Feb 2007 01:06 PM (UTC)
Message
The muds I play actually have recently gotten a setting that allows you to define the amount of characters per line. So for me, it is very much practical as this opens up a better way to display conversations and events on my screen.

Why do I want to be able to resize the window with a script? Because of two reasons:
1) Your stance (which I agree on) that making it an automatic option would be beneficial for mushclients speed.
2) Because this way, I can affect it from my scripts. While right now I just want to be able to resize and use an accelerator/alias/whatever to decide the new width to wrap to, I can imagine it being useful for things such as:
* deciding how many columns to use when trying to sort my shop versus the length of these columns.
* Fixing my right-alignment function that 'overlaps' information so it is actually right aligned instead of set to a 'hard' 80 character border.
* boasting that GetInfo() has yet another use. ;)

But all jokes put aside... how can this harm MushClient? All I am hoping for is the equivalent of a 'GetCharactersPerLine()' function like the 'Config>Display>Adjust width to size' sets for the wrapping amount. Mind, I don't want it to rewrap old data. The only thing it would do would be to get a current value for calculations and make it possibl to change wrapping to that value using SetOption.

The code is already there: it just needs to be given an interface to script to.

Also.. the suggestions Shadowfyr made concerning minimize, maximize and restore have a lot of potential too.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #4 on Fri 02 Mar 2007 08:55 PM (UTC)
Message
A little kick... is there any hope there can be a GetInfo() similar to a 'getVisibleCharactersPerLine()' option? It became rather silent.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sat 03 Mar 2007 01:09 AM (UTC)
Message
Can't you deduce it from the world window size?

http://www.gammon.com.au/scripts/doc.php?function=GetWorldWindowPosition

You would need to know how many pixels an individual letter would take, but for standard fonts and font sizes, this should be easy to find out.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #6 on Sat 03 Mar 2007 01:58 AM (UTC)
Message
Maybe I am lazy/perfectionistic on this point... but isn't that a very sloppy method?

1) I do not know what fonts the users of my plugins are using (assuming I want to use this information to right-align stuff). Okay, I can extract this information from the worldfile with GetOption(). Now I would have to manually calculate every possible font and font-size so my plugin may approximate the amount of characters on a line. Oops, a user uses another font that I don't have: I can download it and start calculating again. Can you honestly say this is the way to go?

Besides, a plugin should be dealing with text. Not with fonts.

2) The code is already present within MUSHclient. I am merely re-inventing the wheel, except that yours is better and mine breaks easier. There is no way my calculations will be 'perfect' like MUSHclient actually displays it.

Sorry for bothering you so much. :)

[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Sat 03 Mar 2007 06:01 AM (UTC)
Message
OK, I'll see if I can at least do some of what you want. My development PC is under the weather a bit right now. It looks like I have to open it up and replace the power supply. This isn't your problem, of course.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #8 on Sat 03 Mar 2007 08:54 AM (UTC)
Message
Although this would be quite simple for a monospace font, anything else would be a vague guess at best, unless the function returns the maximim number of characters displayable for the widest character in the font. A huge string of "iiii..." is quite differnet than a huge string of "wwww..." for anyone who hasn't picked a monospace font. For quite a few MU*s out there, monospace is not required for legibility.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #9 on Sat 03 Mar 2007 02:53 PM (UTC)
Message
@ Nick:

There is no rush. It isn't like I haven't managed all of this time without it. Thank you for your time. :)

@ Shaun Biggs:

Gosh, non-monospaced fonts. THERE is something I completely forgot about. I suppose that'll need a different implementation, though. Hrm. I wonder how Nick's function in mushclient deals with it. (How many 'w' letters fit on a line, perhaps?)
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #10 on Sat 03 Mar 2007 06:25 PM (UTC)
Message
I suspect it simply "assumes" a mono-space font, then wraps at the character that lands on anyway. Kind of bad from the perspective of say Word, but unless you start setting the "wrap" point in inches instead of letters, which would break it for anything that **does** still use mono-space... That MUs now often don't bother with mono-space is "their" problem. lol
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Sat 03 Mar 2007 10:02 PM (UTC)
Message
Quote:

Although this would be quite simple for a monospace font, anything else would be a vague guess at best ...


Bearing in mind MUSHclient wraps at a column count, and not a pixel count, it most definitely assumes a monospace font.

Most MUDs I have seen are geared up to monospace fonts, help displays, status lists, who lists, and so on, are laid out assuming monospaced.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Mon 05 Mar 2007 09:08 PM (UTC)
Message
Version 3.85 adds two new GetInfo selectors (240 and 241).

GetInfo (240) - The average width, in pixels, of a character in the output window, in the current output font. This figure is used when calculating how many characters would fit in the current width of the output window.

GetInfo (241) - The height, in pixels, of a character in the output window, in the current output font.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Tue 06 Mar 2007 12:49 AM (UTC)
Message
Quote:

But, imho, I would add a "maximize", "minimize" and "restore" option for the world windows as well, as per the first example, since that is missing and "moveworldwindow" can't perform that trick.


Added SetWorldWindowStatus function to version 3.85.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


7,699 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]