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 ➜ Installing plugins using windows environment variables.

Installing plugins using windows environment variables.

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


Posted by Bobble   Canada  (76 posts)  Bio
Date Fri 23 Jul 2010 04:30 AM (UTC)
Message
Hello all!

I currently use MUSH on two different computers. In order to save time transferring the world files, I've used Dropbox to store my world files and plugins.

This has caused a bit of a problem however since the folder these files are stored on on each computer is slightly different. So when I load up a world file, it looks for the plugins in the wrong folder.

What I've done is created the same environment variable that leads to the proper folder where the plugins are stored on each computer.

What I wanted to know is if there's any way of modifying the world file or anything else so that it loads the plugins using the environment variable to guide it to the proper folder.

Any help would be appreciated and I'd be happy to provide any clarification as needed.

Take care.

Open the watch.
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 23 Jul 2010 05:02 AM (UTC)
Message
Well, skipping the environment variable for the moment (although you can probably incorporate it), if you get the sqlite3 command-line program from the sqlite site, you could make a batch file that updates the plugins directory location like this:

sqlite3 mushclient_prefs.sqlite "UPDATE prefs SET value = 'C:\Program Files\MUSHclient\my_plugins\' WHERE name = 'PluginsDirectory'"


For versions 4.54 onwards you may also want to set up the plugins state file directory:



sqlite3 mushclient_prefs.sqlite "UPDATE prefs SET value = 'C:\Program Files\MUSHclient\my_plugins\state\' WHERE name = 'StateFilesDirectory'"



Make sure you have the trailing slash on the directory name.

This assumes you have sqlite3.exe somewhere in your path. You would amend the path names as required. Maybe put the environment variable there instead of the hard-coded path name.

You would need to run this in the directory which has the copy of mushclient_prefs.sqlite in it that MUSHclient uses to start up.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 23 Jul 2010 05:05 AM (UTC)
Message
You would also want to make sure that the plugins listed in the world file (the .MCL file) does not have full pathnames. That way, it will take the pathname for the plugins directory from the prefs table, and add on the name of the actual plugin.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Bobble   Canada  (76 posts)  Bio
Date Reply #3 on Sat 24 Jul 2010 07:09 PM (UTC)
Message
Hi Nick,

I've got the batch file set up and when I run it it changes the preferences perfectly. The only thing I'm not sure how to do is get the batch file to run each time I start MUSHclient.

Could you or anyone else give me some direction on this?

Open the watch.
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 24 Jul 2010 09:44 PM (UTC)
Message
In the batch file, after you have updated the database, put the line:


mushclient.exe


That will run MUSHclient. So then just run the batch file instead of MUSHclient (you can make a shortcut to it even, and put that on the Desktop).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Bobble   Canada  (76 posts)  Bio
Date Reply #5 on Sun 25 Jul 2010 01:10 AM (UTC)
Message
Hey Nick,

Thanks for that. I should have come back and let you know that I'd figured that one out on my own. Just had a braincramp before posting.

However, I've run into one final (I hope) problem. While the plugins are all working, the path to the script file and the script editor are staying the same. Is there a way to change the path to the editor and script file via a batch file or some other means?

Open the watch.
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 25 Jul 2010 04:08 AM (UTC)
Message
A script like this would do it:


SetAlphaOption ("script_editor", os.getenv ("MUSHCLIENT_EDITOR"))
SetAlphaOption ("script_filename", os.getenv ("MUSHCLIENT_SCRIPT_FILE"))


However the problem is, when to execute it? You have a bit of a chicken-and-egg situation here. Early on in the loading process, it loads the script engine, so putting those lines into the script file is too late.

What I think will work is putting that into the "Lua Sandbox" (a global configuration). This is executed before loading the script file, so it might just slip in, in time to change the script filename in world startup.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Bobble   Canada  (76 posts)  Bio
Date Reply #7 on Sun 25 Jul 2010 04:15 AM (UTC)

Amended on Sun 25 Jul 2010 04:16 AM (UTC) by Bobble

Message
I'm a bit unclear where to put the path in those two lines. Something like this?

SetAlphaOption ("script_filename", os.getenv ("%MUSHCLIENT%\scripts\basic_system.lua"))


Open the watch.
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #8 on Sun 25 Jul 2010 04:27 AM (UTC)
Message
I just set up (in the Windows Control Panel) and environment variable called MUSHCLIENT_EDITOR which pointed to the editor location. Then os.getenv just pulls in whatever that has in it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Bobble   Canada  (76 posts)  Bio
Date Reply #9 on Sun 25 Jul 2010 04:47 AM (UTC)
Message
Works like a charm on both computers. Thanks a bunch Nick!

Open the watch.
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.


29,178 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.