World.Get Default Plugins Directory

Posted by Magnum on Fri 05 Jul 2002 05:04 PM — 14 posts, 49,830 views.

Canada #0
Quote:

There is a state file for each world/plugin combination.

The file name will look like this:

a282eaabbecd18a56aa07f84-c8efc9f9e1edd118c6f2dbf5-state.xml

This is:

(world ID)-(plugin ID)-state.xml

Each world should have a unique ID, and each plugin should have a unique ID, thus each world's plugin's state should have a unique file name.

I need to emulate this to store files with a plugin. Like the state file, they need to be unique to the current player and world.

Where can I get the World ID? I've been hunting around for the appropriate function...
Canada #1
Sorry, found it myself:

World.GetAlphaOption("id")
Canada #2
Ok, instead, I need to pull the 'Default Plugins Directory'.

The value is not stored in the world file, since it is a global option. If there is a way, please help me out, otherwise, I recommend:

World.GetDefaultPath(PathLabel)

Where PathLabel could currently be:

"Worlds"
"Plugins"
"Logs"

...and perhaps could be expanded in the future to accomodate other Default Paths declared in the Global Settings.

This is gonna be a tough one to workaround for my plugin. :(
Australia Forum Administrator #3
You could get it from the Registry, and I think Krenath asked for something similar. I'll add it to the list. :)
Canada #4
Ok, I'll look into learning how to pull a value from the registry next time I work on the script. I would very much like to avoid writing a plugin that has to be modified by the user to work.
Canada #5
A search for the word "registry" in the VBS Manual file only turns up one non-relevant result...

...so, my question is: How do I pull a value from the registry in VBS?
Amended on Sat 27 Jul 2002 02:33 AM by Magnum
Canada #6
After searching the internet for a while, seems like perhaps VBS is not capable of reading the registry directly. (Need a third party COM called "WSH"?)

If so, that's not really tolerable for me. I can't expect plugin clients to have the COM, and I don't want to distribute addition files and additional instructions.

I assume you're on vacation Nick, and will get back to this sooner or later. :) - Programming burn out?
Australia Forum Administrator #7
Quote:

Programming burn out?


It has been a bit like that - but next week things will be back to normal. A whole lot of things have been happening around here, but next week I should be able to release the plugins version and catch up on some of the forum posts. :)
Canada #8
"Good stuff". :)
Canada #9
Answering my original question, this is the variable I set in my plugin files:

Dim StatePath
StatePath = World.GetInfo(60) & "state\" & World.GetAlphaOption("id") & "-" & World.GetPluginID & " "

My "save file" routine appends the file name to that path. It differs very slightly from the default state files, in that the last character is a 'space' above, where as the MUSHclient state files use a 'dash' as the last character.

Unfortunately, I may end up having to write a whole file management series of routines eventually. Currently, my scripts provide no means through the client to delete files. :(
Australia Forum Administrator #10
I'm not sure about the trailing space, sounds like a dodgy character to have in a file name. Maybe use a $ or something.
Canada #11
It works. Since MUSHclient is Windows only, there shouldn't be a problem.

I'm done my plugin, but need to wait till Tuesday to resolve a problem with my ISP. I don't have access to my own web-space FTP. I'll consider changing the character to something else while I wait. I could probably just do another dash there, since the next thing to follow is always "AOD_EQ_", so it should never collide with actual state files. I've been considering creating a subdir within the state directory as well.
Australia Forum Administrator #12
Quote:

I've been considering creating a subdir within the state directory as well.


Probably a good idea. The state file names are hardly intuitive, to say the least, and that is just the ones I did. :)
Canada #13
Yes, I've already made the change. The files for my "AOD_EQ" plugin get saved with a subdirectory of the 'state' directory, the subdirectory haveing the same name as the plugin: "AOD_EQ".

Technically, someone could write a plugin with the same name as one of my own, and thus create directory confusion... LOL, However, I still use the double-id's, so my actual plugin state files should not be overwritten.