Register forum user name Search FAQ

Gammon Forum

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 ➜ Bug reports ➜ setting background image after failure seems ineffective

setting background image after failure seems ineffective

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


Posted by Fiendish   USA  (2,537 posts)  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
Top

Posted by Worstje   Netherlands  (899 posts)  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. :)
Top

Posted by Fiendish   USA  (2,537 posts)  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
Top

Posted by Nick Gammon   Australia  (23,158 posts)  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
Top

Posted by Fiendish   USA  (2,537 posts)  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
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.


17,286 views.

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

Go to topic:           Search the forum


[Go to top] top

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