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 ➜ General ➜ Makerect Resizing

Makerect Resizing

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


Posted by Xerakon   USA  (5 posts)  Bio
Date Fri 11 Apr 2014 10:22 PM (UTC)
Message
Hello!

I have used the makerect code found in other places across this site to make a background image. And I have the setting so that my main MUD window is on the left hand side with 85 characters of length.

In the scripts section, under World Events > Open, I have "!makerect" in the box so that the alias runs whenever the world opens to properly background everything.

However, when the world opens, the mud window is on the top left (as it should be), but only goes down about half the length of the overall window instead of fully to the bottom, as it should. Typing "makerect" corrects this. Any ideas on how to properly set this for the world open?


local background_window = "world_background_image"  -- miniwindow ID

-- location for window (and image)

local left = 6
local top = 6
local right = left + GetInfo (213) * 85 -- offset + width for 80 characters
local bottom = GetInfo (280) - 6  -- 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) .. "bobavader.png"))

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

-- show the window
WindowShow (background_window, true)

SetBackgroundImage("bobavader.png", 2)
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #1 on Sat 12 Apr 2014 04:38 PM (UTC)

Amended on Sat 12 Apr 2014 04:39 PM (UTC) by Fiendish

Message
You have to be really careful about when you trust things like GetInfo(280). Window geometry is extremely unstable when MUSHclient is launching.

I have a OnPluginWorldOutputResized() callback in one of my plugins. If I add
   print(GetInfo(280),"    ",GetInfo(281),"    ",utils.timer())
to it, this is what happens while MUSHclient is starting up...


416      654      3786.4639798
416      654      3786.4663103
416      654      3786.4680628
416      654      3786.4695492
416      654      3786.4734536
416      654      3786.475504
416      654      3786.4777535
416      654      3786.4801173
416      654      3786.4828858
416      654      3786.4845363
416      654      3786.4859357
416      654      3786.4871511
416      654      3786.4884576
416      654      3786.4896897
416      654      3786.4908862
416      654      3786.492088
416      654      3786.4932156
416      638      3786.494643
416      638      3786.4955345
416      638      3786.4964184
416      638      3786.4973349
416      638      3786.4982029
416      638      3786.4991004
416      638      3786.5000136
416      638      3786.5010155
416      638      3786.5020501
416      638      3786.5033996
416      638      3786.504634
416      638      3786.505882
416      638      3786.5071494
416      638      3786.5081781
416      638      3786.5090755
Welcome to MUSHclient version 4.91!
Written by Nick Gammon.

Compiled: Oct 17 2013.
Using: Lua 5.1.4, PCRE 8.33, PNG 1.5.14, SQLite3 3.8.0.2, Zlib 1.2.8

For information and assistance about MUSHclient visit our forum at:
   http://www.gammon.com.au/forum/
Can you trust your plugins?  See: http://www.gammon.com.au/security
416      745      3782.8329601
416      745      3782.8332931
416      745      3782.8335817
416      745      3782.8338509
416      745      3782.8341463
416      745      3782.83446
416      745      3782.8347302
416      745      3782.835
416      745      3782.8352702
416      745      3782.8355466
416      745      3782.8358152
416      745      3782.8360827
416      745      3782.8363758
416      745      3782.8366464
416      745      3782.8369153
416      745      3782.8371917
416      745      3782.8374357
416      729      3782.8376174
416      729      3782.8377059
416      729      3782.8377895
416      729      3782.8378716
416      729      3782.8379544
416      729      3782.8380346
416      729      3782.8381163
416      729      3782.8381998
416      729      3782.8382819
416      729      3782.8383734
416      729      3782.8384585
416      729      3782.8385421
416      729      3782.8386254
416      729      3782.8387089
416      729      3782.8387924
416      654      3786.3993227
416      654      3786.401796
416      654      3786.4032652
416      654      3786.4046619
416      654      3786.4063094
416      654      3786.407763
416      654      3786.4095481
416      654      3786.411471
416      654      3786.4129608
416      654      3786.4144273
416      654      3786.4160214
416      654      3786.4175342
416      654      3786.4189432
416      654      3786.420656
416      654      3786.4219699
416      638      3786.423078
416      638      3786.4239442
416      638      3786.4246528
416      638      3786.4253582
416      638      3786.4261202
416      638      3786.4268484
416      638      3786.427662
416      638      3786.4283553
416      638      3786.4290302
416      638      3786.429718
416      638      3786.4304072
416      638      3786.4310825
416      638      3786.4317988
416      638      3786.4324553
416      638      3786.4330994
416      654      3786.434747
416      654      3786.4357282
416      654      3786.4365982
416      654      3786.4375447
416      654      3786.4384297
416      654      3786.4392874
416      654      3786.4401531
416      654      3786.4410163
416      654      3786.4419515
416      654      3786.4428588
416      654      3786.4437723
416      654      3786.4446832
416      654      3786.4456166
416      654      3786.4465268
416      654      3786.4475444
416      654      3786.4484712
416      654      3786.4493666
416      638      3786.4505818
416      638      3786.4514143
416      638      3786.4520945
416      638      3786.4528197
416      638      3786.4535063
416      638      3786.4541819
416      638      3786.4548973
416      638      3786.4555971
416      638      3786.4563221
416      638      3786.4570135
416      638      3786.4577153
416      638      3786.458401
416      638      3786.459088
416      638      3786.4600948
416      638      3786.4613379
416      638      3786.5247011
416      638      3786.5256469
402      736      3786.5310473
381      736      3786.5333703
381      1260      3786.5481285
633      1260      3786.5530691
633      1252      3786.6398411
625      1252      3786.6451926

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.


12,160 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.