GetInfo size fields at startup

Posted by Fiendish on Mon 04 Jul 2011 05:33 AM — 4 posts, 12,366 views.

USA Global Moderator #0
If I do print(GetInfo(250),GetInfo(281)) in OnPluginInstall in a plugin that gets loaded in a world that loads at client start, I get "1278 817"

If I do it a second later with DoAfterSpecial, I get "1278 1258"

Why is GetInfo(281) not reliable right at startup like 250 seems to be?
Amended on Mon 04 Jul 2011 05:34 AM by Fiendish
Australia Forum Administrator #1
There are various race conditions that are likely to occur during startup. For example the world window might resize as various directives are read, such as font size, whether automatic resizing is in force, and then it reads the current world window dimensions from the .ini file.

It might be better to do things like getting the window size during the OnPluginListChanged callback. Possibly also the OnPluginWorldOutputResized callback might help.

I don't have the source to hand right now (apart from Git of course) so I can't totally confirm which would be best.
Australia Forum Administrator #2
I think that is recalled in response to a WM_SIZE windows message, and they seem to arrive at all sorts of odd times. For example, before the window fully exists. And possibly under Wine you may get different results again.
USA Global Moderator #3
Sorry, I guess I ninjaed you :\