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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Is there a plugin to display prompt as-is at the bottom of the window?

Is there a plugin to display prompt as-is at the bottom of the window?

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


Posted by BattleJenkins   (4 posts)  [Biography] bio
Date Mon 14 Mar 2016 01:16 AM (UTC)
Message
Hey, everyone! Sorry to bother you all with what must be a very simple question, but I've searched all over and I haven't been able to find a plugin that will do this simple thing that I want.

I play a game called The Inquisition: Legacy which features a customizable prompt which I have set up just the way I like. I just started using MUSHclient, and was wondering if there's a way I can just have an updating representation of my prompt locked at the bottom of the window - no fancy bars or anything, just the prompt displaying as-is, with maybe a little divider line above it.

So this is what I've got now:

http://puu.sh/nFFoU/aa7abca1aa.png

And this is what I would like it more to look like:

http://puu.sh/nFFGx/25ec9d3b33.png

I'm sure this wouldn't be hard to pull off at all, but I'm not even sure where to begin!

Thanks in advance for your help!
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 14 Mar 2016 06:38 AM (UTC)
Message
There's a tutorial here that shows something similar:

http://www.gammon.com.au/forum/?id=9626

That captures exits, not the prompt, but the concept is the same. To omit the prompt at the same time set the trigger to "omit from output".

- Nick Gammon

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

Posted by BattleJenkins   (4 posts)  [Biography] bio
Date Reply #2 on Mon 14 Mar 2016 09:16 AM (UTC)
Message
Thank you so much for the help! So here's what I ended up getting:

http://puu.sh/nG1kh/6e7d762a1a.png

Wuh-oh.

Here's the code I've got:

Trigger: *Galen: [*

win = GetPluginID () .. ":prompt"
font = "f"

WindowCreate (WindowName, 0, 0, 1, 1, 10, 0, 0)

WindowFont (win, font, "ProFontWindows", 9)

height = WindowFontInfo (win, font, 1) +10

width = WindowTextWidth (win, font, "%0") +10

WindowCreate (win, 0, 0, width, height, 10, 0, ColourNameToRGB "black")

WindowText (win, font, "%0", 5, 5, 0, 0, ColourNameToRGB ("white"))

WindowShow (win, true)


I followed your tutorial to the T, save for changing some of the variables to get the window to display in the right place and all. What is it that's not quite working out here...?
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Mon 14 Mar 2016 11:53 AM (UTC)
Message
Quote:
WindowCreate (WindowName, 0, 0, 1, 1, 10, 0, 0)

Uses a variable WindowName which you don't have defined. You probably meant win.

Though recreating the window every time the trigger fires is a bit heavy-handed.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by BattleJenkins   (4 posts)  [Biography] bio
Date Reply #4 on Mon 14 Mar 2016 07:11 PM (UTC)
Message
Heck! This is what I get for not learning Lua. I also noticed another syntax error I made with the ColourToRGB function, missing the parens there...

I'm not at home now, so I can't test it out with the changes - what might be a more elegant solution than recreating the window every time the trigger fires?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Mon 14 Mar 2016 07:51 PM (UTC)
Message
Quote:

I also noticed another syntax error I made with the ColourToRGB function, missing the parens there...


Lua allows this:


ColourNameToRGB "black"


You can have a string or table (single) argument to a function without using parentheses.




Quote:

what might be a more elegant solution than recreating the window every time the trigger fires?


Create it once (at some suitable point) and then each time, just blank it out (draw a rectangle with the desired colour).

- Nick Gammon

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

Posted by BattleJenkins   (4 posts)  [Biography] bio
Date Reply #6 on Tue 15 Mar 2016 01:26 AM (UTC)
Message
Thanks for the feedback, everyone! With your help, I've managed to get something pretty close to what I want!

http://puu.sh/nGT6I/605df1cfef.png

It just has a couple of problems - it threatens to cut off the most recent output from the world (luckily it's still legible, but it does cut off the descenders on the font I'm using) and I'm not quite sure how to pass the ANSI colors through... I'd really appreciate any help with these problems, but even this is a great start!
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Tue 15 Mar 2016 05:22 AM (UTC)
Message
You can use TextRectangle to reduce the size used for MUD output. A useful thing to do would be to trim some off the bottom.

Template:function=TextRectangle TextRectangle

The documentation for the TextRectangle script function is available online. It is also in the MUSHclient help file.



You can pass colours into the miniwindow by capturing the style runs from the prompt line. See:

http://gammon.com.au/mushclient/mw_text.htm

Scroll down to Hint 5 (near the bottom).

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Tue 15 Mar 2016 06:22 AM (UTC)

Amended on Tue 15 Mar 2016 10:13 AM (UTC) by Nick Gammon

Message
To show the idea, this trigger will do it:


<triggers>
  <trigger
   enabled="y"
   match="&lt;*&gt;*"
   omit_from_output="y"
   send_to="14"
   sequence="100"
  >
  <send>

win = GetPluginID () .. "_prompt"
font = "f"
backgroundColour = ColourNameToRGB "dimgray"

-- create window if necessary
if not WindowInfo (win, 1) then
  WindowCreate (win, 0, 0, 1, 1, miniwin.pos_bottom_left, 0, 0)
  WindowFont (win, font, "Courier", 9)
  height = WindowFontInfo (win, font, 1)  + 10
  TextRectangle (0, 0, 0, -(height + 2), 5, 0, 0, 0, miniwin.brush_solid)
end -- if

-- work out width of this prompt
width = WindowTextWidth (win, font, "%0") + 10
-- resize the window to fit
WindowResize (win, width, height , backgroundColour )
-- clear the window
WindowRectOp ( win, miniwin.rect_fill, 0, 0, 0, 0, backgroundColour )

left = 5
-- show each style run
for _, v in ipairs (TriggerStyleRuns) do
  left = left + WindowText (win, font, v.text, left, 5, 0, 0, v.textcolour)
end -- for

-- make sure window visible
WindowShow (win, true)

</send>
  </trigger>
</triggers>


- Nick Gammon

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

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #9 on Tue 15 Mar 2016 10:36 AM (UTC)
Message
Quote:
It just has a couple of problems - it threatens to cut off the most recent output from the world (luckily it's still legible, but it does cut off the descenders on the font I'm using)

So don't make your miniwindow so arbitrarily large. Look at all that extra vertical padding you added that you can trim off.

https://github.com/fiendish/aardwolfclientpackage
[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.


22,258 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 HostDash]