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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Moving Mud Output
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Miloh
(4 posts) 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) 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
|
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 | | Top |
|
| Posted by
| Miloh
(4 posts) Bio
|
| Date
| Reply #2 on Thu 29 Apr 2010 03:45 PM (UTC) |
| Message
| | Awesome, worked perfectly. Thank you kindly! | | Top |
|
| Posted by
| KaVir
Germany (117 posts) 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().
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) 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 | | Top |
|
| Posted by
| KaVir
Germany (117 posts) 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?
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) 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 | | Top |
|
| Posted by
| KaVir
Germany (117 posts) 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!
| | 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.
31,854 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top