diff --git a/install/mushclient.nsi b/install/mushclient.nsi index e877b591..e987c7e0 100644 --- a/install/mushclient.nsi +++ b/install/mushclient.nsi @@ -472,6 +472,7 @@ Section "Plugins" File "..\plugins\Config_Option_Changer.xml" File "..\plugins\Current_Output_Window.xml" File "..\plugins\Gag.xml" + File "..\plugins\Global_Option_Updater.xml" File "..\plugins\Health_Bar.xml" File "..\plugins\Hyperlink_URL.xml" File "..\plugins\InfoBox_Demo.xml" @@ -710,6 +711,7 @@ Section Uninstall Delete "$INSTDIR\worlds\plugins\Config_Option_Changer.xml" Delete "$INSTDIR\worlds\plugins\Current_Output_Window.xml" Delete "$INSTDIR\worlds\plugins\Gag.xml" + Delete "$INSTDIR\worlds\plugins\Global_Option_Updater.xml" Delete "$INSTDIR\worlds\plugins\Health_Bar.xml" Delete "$INSTDIR\worlds\plugins\Hyperlink_URL.xml" Delete "$INSTDIR\worlds\plugins\InfoBox_Demo.xml" diff --git a/plugins/Global_Option_Updater.xml b/plugins/Global_Option_Updater.xml new file mode 100644 index 00000000..3d93a68e --- /dev/null +++ b/plugins/Global_Option_Updater.xml @@ -0,0 +1,145 @@ + + + + + + + list all valid option names +show_global_option x --> displays value of option +change_global_option x y --> changes value of option x to y + + +eg. + +show_global_option FixedPitchFont + +change_global_option FixedPitchFont Dina + +After changing an option you should exit the client and re-open it, otherwise +if you use the GUI interface (global preferences) it may put the option back again. + +]]> + + + + + + + + + + + +-- open preferences database +local db = assert (sqlite3.open (GetInfo (82))) +local value = nil + +-- see if this key already exists (if not, probably spelling error) +for a in db:nrows "SELECT * FROM prefs WHERE name = '%1'" do + value = a.value +end -- for + +-- if found, modify it +if value then + + if db:execute ("UPDATE prefs SET value = '%2' WHERE name = '%1'") ~= sqlite3.OK then + ColourNote ("red", "", "Unable to modify preferences: " .. db:errmsg ()) + else + if value ~= "%2" then + ColourNote ("cyan", "", "Item '%1' changed from '" .. value .. "' to '%2'") + else + ColourNote ("cyan", "", "No change required, value of '%1' is already '%2'") + end -- if + end -- if updated OK + +else + ColourNote ("red", "", "Item '%1' is not in preferences database") +end -- does not exist + +db:close() + + + + + + + +-- open preferences database +local db = assert (sqlite3.open (GetInfo (82))) +local value = nil + +-- find the item +for a in db:nrows "SELECT * FROM prefs WHERE name = '%1'" do + value = a.value +end -- for + +-- if found, display it +if value then + ColourNote ("cyan", "", "Item '%1' has value '" .. value .. "'") +else + ColourNote ("red", "", "Item '%1' is not in preferences database") +end -- does not exist + +db:close() + + + + + + + + -- open preferences database +local db = assert (sqlite3.open (GetInfo (82))) + +ColourNote ("cyan", "", "Global Options") +ColourNote ("cyan", "", string.rep ("-", 40)) + +-- show all +for a in db:nrows "SELECT * FROM prefs ORDER BY name" do + ColourNote ("cyan", "", a.name) +end -- for + +ColourNote ("cyan", "", string.rep ("-", 40)) + +db:close() + + + + + + + + +