[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  GetInfo(67), GetInfo(54)

GetInfo(67), GetInfo(54)

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


Posted by Astarte   Germany  (8 posts)  [Biography] bio
Date Sun 03 Jan 2010 05:56 PM (UTC)

Amended on Sun 03 Jan 2010 06:00 PM (UTC) by Astarte

Message
It seems that that
GetInfo(54)
is still empty when a plugin is loaded. Thus
GetInfo(67)
returns ".\". It seems to me that this is unintentional since in later stages (i. e. when the world is connected to and running) these function calls return different and correct values in the same plugin.
So I think this could be a minor bug. I would love to have clarification on that one, maybe I am just using the wrong number for what I tried to do.
I stumbled over this when just wanting to load a background picture for different worlds from a plugin they each could use. I tried to define the automagical path for this as
GetInfo(67) + GetInfo(2) + "\Background.png"
which should then yield something similar to
"C:\Programme\MUSHclient\worlds\<world_name>\Background.png"
However, I got
".\<world_name>\Background.png"
instead, as described, and thus failed to load the image.
I patched this using
GetInfo(66) + GetInfo(57) + GetInfo(2) + "\Background.png"
for now, but it seems quite wrong to have to do this and I guess things would break if I moved the world with its image subfolder to a different location...
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #1 on Sun 03 Jan 2010 06:08 PM (UTC)
Message
Where are you putting that code? Is it loose in the script area of the plugin (not within any function)? If so, maybe try putting it in an OnPluginInstall callback. I know that a lot of things probably aren't "ready" when the plugin itself is just loaded; generally that's the time when function definitions are created and global variables are prepared, but not much work is actually done.

(If you're correct, I agree that this is probably a bug, though.)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Astarte   Germany  (8 posts)  [Biography] bio
Date Reply #2 on Sun 03 Jan 2010 07:48 PM (UTC)
Message
It doesn't matter, you can put it just loosely in the script or in OnPluginInstall Callback. The result is unfortunately the same.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sun 03 Jan 2010 08:16 PM (UTC)
Message
Seems like a bug. In fact the bug is in the core MFC libraries, since it seems that the library function GetPathName does not return a pathname during document serialization (which is where plugins are initially loaded).

However it knows the path of the document (naturally) as it is reading it in. I have put in an extra line that forces the document pathname to be the file pathname during serialization.

This appears to fix the bug. Applied in version 4.46.

As a workaround you may want to use GetPluginInfo (20) - the directory this particular plugin is installed in.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sun 03 Jan 2010 08:18 PM (UTC)
Message
GetInfo(67) uses the information from GetInfo(54) so that would explain that behaviour.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sun 03 Jan 2010 08:19 PM (UTC)
Message
Another workaround for the moment would be to use a timer, that waits a second and then loads the background. I think this behaviour is only during the initial world serialization.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


12,022 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 HostDash]