[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]  Bug reports
. . -> [Subject]  setting background image after failure seems ineffective
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

setting background image after failure seems ineffective

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


Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Sun 03 Jun 2012 11:16 PM (UTC)

Amended on Mon 04 Jun 2012 04:38 AM (UTC) by Fiendish

Message
I am finding that, in the event that my image path is invalid or the file is corrupt, the following code does not save the background from turning blue-green. Am I doing something wrong?


if 0 ~= SetBackgroundImage(imgpath,13) then
   ColourNote("yellow","red","Error loading background image.")
   SetBackgroundImage("",0)
   SetBackgroundColour(0x000000)
end


The note appears but the background is not salvaged.

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

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #1 on Mon 04 Jun 2012 05:10 AM (UTC)
Message
Do you have any other scripts running?

I opened a fresh world through a bogus Quick Connect, went to the immediate window and pasted your code there. I initialized imgpath to a dummy location, and made the colour a dark reddish colour, which worked fine. It also worked when I made my background another colour first, and used the original black colour from your sample.

Thus, I cannot help but think the problem is elsewhere in your code, be it in another plugin or script, or temporary code you've forgotten about or did not properly comment/remove at some point. :)
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #2 on Mon 04 Jun 2012 11:35 PM (UTC)

Amended on Mon 04 Jun 2012 11:55 PM (UTC) by Fiendish

Message
I realize now that I just had the wrong color set in the outsidefillcolour TextRectangle field.

Quote:
I opened a fresh world through a...

Try this first and you'll see what I mean.
TextRectangle(10, 10, 300, 300,
      5,  -- BorderOffset, 
      ColourNameToRGB ("darkgray"),    -- BorderColour, 
      2,  -- BorderWidth, 
      ColourNameToRGB ("darkslategray"),  -- OutsideFillColour, 
      miniwin.brush_solid) -- OutsideFillStyle


Nick, the documentation for SetBackgroundImage says
Quote:
This sets a background image for output window. The text in the output window is drawn on top of this. If the image does not completely fill the window, the background colour is visible beneath it.

But, if you use a TextRectangle, this is not an analogous effect to SetBackgroundColour. That's a bit confusing.

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

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 05 Jun 2012 03:49 AM (UTC)
Message
Ah yes, it looks like it draws the rectangle after the background image. That would explain what you saw would it?

- Nick Gammon

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

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Tue 05 Jun 2012 12:20 PM (UTC)
Message
Nick Gammon said:

Ah yes, it looks like it draws the rectangle after the background image. That would explain what you saw would it?
Indeed. And that's fine. I just got momentarily confused by SetBackgroundColour setting the main output area color vs SetBackgroundImage setting what shows behind the main output. Could you perhaps just add a note on the SetBackgroundColour docs referencing the outsidefill field of TextRectangle?

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.


3,811 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]