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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Moving Mud Output

Moving Mud Output

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


Posted by Miloh   (4 posts)  [Biography] bio
Date Wed 28 Apr 2010 08:18 PM (UTC)
Message
Greetings all,

I am using the latest Mushclient along with a miniwindow plugin to display the map. I'd like to be able to place the map miniwindow on the left, and the mud output on the right side. Is there an easy way to do this? I found a spot where I can set off set the output, but the max value is very low which winds up only moving it a very small amount to the right.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 28 Apr 2010 10:01 PM (UTC)

Amended on Wed 28 Apr 2010 10:02 PM (UTC) by Nick Gammon

Message
Template:function=TextRectangle TextRectangle

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



Example:


<aliases>
  <alias
   match="makerect"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

TextRectangle(350,   -- left
              400,  -- top
              350 + GetInfo (213) * 80, -- offset + width for 80 characters
              -15,  -- pixels from the bottom
              5,  -- BorderOffset, 
              ColourNameToRGB ("gray"),    -- BorderColour, 
              2,  -- BorderWidth, 
              ColourNameToRGB ("silver"),  -- OutsideFillColour, 
              8) -- OutsideFillStyle (fine hatch)

</send>
  </alias>
</aliases>


You can play with the numbers. Type "makerect" to have it do its stuff. You can put "!makerect" in the "world open" box in the scripting configuration to have it do this every time you open the world.

- Nick Gammon

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

Posted by Miloh   (4 posts)  [Biography] bio
Date Reply #2 on Thu 29 Apr 2010 03:45 PM (UTC)
Message
Awesome, worked perfectly. Thank you kindly!
[Go to top] top

Posted by KaVir   Germany  (117 posts)  [Biography] bio
Date Reply #3 on Wed 05 May 2010 08:49 AM (UTC)
Message
On a related note, is there an easy way to provide an actual background image behind the text window, rather than just an outside fill colour/style?

I can do SetBackgroundImage ("background.bmp", 13) and it produces a nice textured background in the same theme as my website, but it also covers the TextRectangle().
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 05 May 2010 09:39 PM (UTC)
Message
Yes that is fairly simple. You need to make a miniwindow, and set it to be drawn underneath the text. Here is an example:


<aliases>
  <alias
   match="makerect"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

local background_window = "world_background_image"  -- miniwindow ID

-- location for window (and image)

local left = 350
local top = 400
local right = left + GetInfo (213) * 80 -- offset + width for 80 characters
local bottom = GetInfo (280) - 15  -- 15 pixels from bottom

-- tell the client where to draw the text
TextRectangle(left,  
              top,   
              right,
              bottom,  
              5,  -- BorderOffset, 
              ColourNameToRGB ("gray"),    -- BorderColour, 
              2,  -- BorderWidth, 
              ColourNameToRGB ("silver"),  -- OutsideFillColour, 
              8) -- OutsideFillStyle (fine hatch)

-- make a miniwindow under the text
check (WindowCreate (background_window,   -- window ID
              left, 
              top,   
              right - left, -- width
              bottom - top, -- depth
              12,  -- center it (ignored anyway) 
              3,   -- draw underneath (1) + absolute location (2)
              0x000000))  -- background colour

-- load the background image
check (WindowLoadImage (background_window, "background", GetInfo (66) .. "background_image.png"))

-- draw it
check (WindowDrawImage (background_window, "background", 0, 0, 0, 0, 1))  -- draw it

-- show the window
WindowShow (background_window, true)

</send>
  </alias>
</aliases>


This example draws without scaling, so a suitable image would be one that fits the area you have allocated. Alternatively with a bit more fiddling around you can scale, preserving the aspect ratio, so you can accommodate any size image (although there may be black bars if the image's aspect ratio is not the same as the text box's aspect ratio).

- Nick Gammon

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

Posted by KaVir   Germany  (117 posts)  [Biography] bio
Date Reply #5 on Thu 06 May 2010 10:51 AM (UTC)
Message
Thanks for the help! The SetBackgroundImage() I used before has a mode 13, which displays the image as a series of tiles, but WindowDrawImage() doesn't seem to have that option.

I was trying to use a bmp version of this tile image here: http://www.godwars2.org/images/corroded.jpg

Presumably I could achieve a similar result by creating a really large image and then using the SrcLeft, SrcTop, SrcRight and SrcBottom arguments to cut out an appropriately sized piece of the image, based on the size of the window. Actually, would I even need to do that? If the image was too big, wouldn't the excess image effectively be ignored anyway?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Thu 06 May 2010 08:35 PM (UTC)
Message
You could tile easily enough by simply doing multiple WindowDrawImage calls, until you had drawn enough of them horizontally and then vertically, to fill whatever space you needed to fill.

Any excess will be truncated.

- Nick Gammon

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

Posted by KaVir   Germany  (117 posts)  [Biography] bio
Date Reply #7 on Thu 06 May 2010 09:08 PM (UTC)

Amended on Thu 06 May 2010 10:48 PM (UTC) by KaVir

Message
I just had the chance to test it out, and I think perhaps I phrased my original question poorly - I didn't want the image to appear within the TextRectangle itself, but everywhere else. Your solution provided exactly what I needed though, once I'd commented out the WindowLoadImage and WindowDrawImage and added the SetBackgroundImage.

-- load the background image
--check (WindowLoadImage (background_window, "background", GetInfo (66) .. "corroded2.bmp"))

-- draw it
--check (WindowDrawImage (background_window, "background", 0, 0, 0, 0, 1))  -- draw it

-- show the window
WindowShow (background_window, true)

SetBackgroundImage("corroded2.bmp", 13)


The result is here: http://www.godwars2.org/images/mushclient_background.png

I've not yet decided how much space I want around the text windows, but I rather fancy using the left side for buttons and perhaps having some sort of image at the top. The right side has space for a map and something else. The three bars at the bottom are based on your experience bar, and they show health, mana and actions.

Obviously not everyone will like the layout, so I'll try and keep it easy to change, but I'm having quite a bit of fun playing around with this!
[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.


23,274 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]