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
➜ GetInfo(67), GetInfo(54)
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Astarte
Germany (8 posts) 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 is still empty when a plugin is loaded. Thus 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... | | Top |
|
| Posted by
| Twisol
USA (2,257 posts) 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 | | Top |
|
| Posted by
| Astarte
Germany (8 posts) 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) 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 | | 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,616 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top