Prefref Plus -- ZLib script settings AND KoLmafia properties manager

zarqon

Well-known member
icon-refplus-small.png
Prefref Plus

Prefref Plus -- the first of my Reference Plus family of scripts -- is a one-stop manager for all of your ZLib script settings (replacing the old WOSSMAN script) and KoLmafia properties.

What Does It Do?

It displays all your settings and properties in a table like this:

screen-PrefrefPlus.png

Then, like mafia's "prefref" command, you can filter the table based on what you type in the search box. You can also filter the table by data type, daily properties (including those not beginning with an underscore), choiceAdventure properties, and quest properties. Right away, you'll notice that some of them appear in different colors:

  • Grey: the setting/property is currently set to its default value.
  • Green: the setting/property has been changed from its default value.
  • Red: the setting/property has no default value. This can happen when 1) a user or script adds a new KoLmafia property using the "set" command, b) a script that initiated a ZLib script setting hasn't been run since the settings revamp of ZLib r32 in May 2017, or III) when a KoLmafia dev adds a new property but overlooks adding a default. :) You can filter the table down to only these by clicking the No Default filter.
Mousing over a property name reveals the property's documentation (if present), default value, and current value. If the value has been changed from the default, it even gives you a diff of the two underneath, so you can quickly see what's changed. For quest properties, a breakdown of each quest step and the text that mafia associates with it are presented in a table. For choiceAdventures, Prefref Plus also gets you started in tracking down the Wiki information for that particular choice with a handy link (this link will hopefully become less important as documentation is added for each property).

Clicking a value will enter Edit Mode. Here you can change any of the settings or properties to a new value. For values with a specified data type such as "item", the browser will helpfully offer auto-complete suggestions as you type. Press Enter to submit your new value, or ESC to cancel Edit Mode. Also, using the icons to the right, you can revert settings or properties to their defaults, or in the case of ZLib script settings and user properties without defaults, delete them entirely. There will be a confirmation that pops up for these cases, to hopefully avoid misclicks. In case of a double-misclick, the setting/property's previous value can be found in your CLI output.

It may load a little slowly the first time you run it each session, but much of the page is built statically so it will load much more quickly after that.

Important Note: If you ever want to interact with the information window that pops up, for example to click a choiceAdventure link or to scroll down to see all 30 steps of the Nemesis quest, you can hold down SHIFT to prevent the window from disappearing while you move your mouse over to it.

Installation

Type this in your CLI:
Code:
svn checkout https://svn.code.sf.net/p/reference-plus/code/

As always, Enjoy!

Update 7/19/2018: Skillref Plus is here! Link in my sig. Itemref Plus coming soon!
It is my hope that this may be the script that entices Veracity to use one of my scripts! Fingers crossed.
 
Last edited:
Installed this, get the filter screen but nothing below the column headers. Here's the installation dialogue:
C:\Users\Dave\Desktop\Gaming\KOL\svn\reference-plus
A https://svn.code.sf.net/p/reference-plus/code/relay
A https://svn.code.sf.net/p/reference-plus/code/relay/datatables.min.js
A https://svn.code.sf.net/p/reference-plus/code/relay/diff_match_patch.js
A https://svn.code.sf.net/p/reference-plus/code/relay/jquery.pretty-text-diff.min.js
A https://svn.code.sf.net/p/reference-plus/code/relay/prefrefplus.js
A https://svn.code.sf.net/p/reference-plus/code/relay/refplus.css
A https://svn.code.sf.net/p/reference-plus/code/relay/relay_PrefrefPlus.ash
A https://svn.code.sf.net/p/reference-plus/code/dependencies.txt
https://svn.code.sf.net/p/reference-plus/code
At revision 1

Successfully checked out working copy.
Pushing local updates...
relay_PrefrefPlus.ash => C:\Users\Dave\Desktop\Gaming\KOL\relay\relay_PrefrefPlus.ash
refplus.css => C:\Users\Dave\Desktop\Gaming\KOL\relay\refplus.css
prefrefplus.js => C:\Users\Dave\Desktop\Gaming\KOL\relay\prefrefplus.js
jquery.pretty-text-diff.min.js => C:\Users\Dave\Desktop\Gaming\KOL\relay\jquery.pretty-text-diff.min.js
diff_match_patch.js => C:\Users\Dave\Desktop\Gaming\KOL\relay\diff_match_patch.js
datatables.min.js => C:\Users\Dave\Desktop\Gaming\KOL\relay\datatables.min.js
Done.
Requests complete.
 

zarqon

Well-known member
That seems like what might happen without jQuery, which comes with ZLib. Try updating ZLib? Check that you have a file called jquery1.10.1.min.js in your relay folder, and that you haven't disabled JavaScript in your browser.
 
Last edited:

AlbinoRhino

Active member
Same for me. Thanks !

edit: It even recognizes things I've added to defaults.txt in my local build. Sweet...

Code:
        Password hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_min_ml_familiar&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_min_ml_mood&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_max_ml_familiar&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_fumble_buffer&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_fumble_buffer&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_fumble_buffer&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_max_ml_familiar&which=desc&pwd=hash"
Password     hash mismatch
Path:     "/relay_PrefrefPlus.ash?source=ZLib∝=SlimeTube_max_ml_ccs&which=desc&pwd=hash"


Hmmm....doesn't appear that it recognizes when the hash changes during a particular mafia session.

This will happen when mafia (or KoL I suppose) automatically logs you out (not sure what the time limit on this is, but I know it's way too short for me...I get logged out a lot).

This is usually resolved by simply closing any relay browser that was opened before the logout and then opening a new browser post-re-login. Then the mafia browser is aware of the new hash.

I did this but I am still getting the messages above. So it seems that this script specifically is not learning the new hash ?
 
Last edited:

AlbinoRhino

Active member
P.S. The mismatch messages are appearing when hovering over a prop value and the script attempts to draw the popup with the prop info.
 

zarqon

Well-known member
Ah right, I ran into that months back but I'm usually lurking in chat so I don't get logged out and therefore haven't encountered it in so long that I forgot it was an issue I needed to fix before release and wow this sentence is long. Presently the hash is part of the static page build so it doesn't get changed throughout your mafia session. Will have a go at fixing that tomorrow after work.
 

AlbinoRhino

Active member
Great. Thanks again !

edit:
I guess I need to get into the habit of opening a chat I have no interest in using ! lol

edit2:

Just added chat as a startup tab ... maybe no more logouts !
 
Last edited:
That seems like what might happen without jQuery, which comes with ZLib. Try updating ZLib? Check that you have a file called jquery1.10.1.min.js in your relay folder, and that you haven't disabled JavaScript in your browser.

Had jquery1.10.2.min, deleted it, deleted and reinstalled Prefref Plus. Deleted and reinstalled ZLib. All is well. Thanks!
 

zarqon

Well-known member
@Pooter: Glad that fixed it! Seems your dependencies may not have installed for whatever reason? Maybe check to make sure CLI Links got installed as well. Check for clilinks.ash and .js in your relay folder and if they're not there, follow the link in my sig for CLI Links.
 
Last edited:
@Pooter: Glad that fixed it! Seems your dependencies may not have installed for whatever reason? Maybe check to make sure CLI Links got installed as well. Check for clilinks.ash and .js in your relay folder MD if they're not there, follow the link in my sig for CLI Links.

Both there, mod date back in 2015. Thanks again, your hard work is appreciated.
 

lostcalpolydude

Developer
Staff member
In case of a double-misclick, the setting/property's previous value can be found in your CLI output.

The previous value is not showing up in the CLI, just the name of the setting I deleted. This hasn't been a problem for me so far...
 

zarqon

Well-known member
r2 Update

Thanks to swift reports from the people above, we now have the script I intended to release as r1. Changes:

  • Don't load your hash as part of the static page build. Instead, AJAX it into a JS variable when we load the page. Now if you get logged out, or login as a different character (the main reason for using the hash to begin with), you will be prompted to reload the relay script, which will make everything work once more.
  • Don't use pwd for passing the hash -- in the event of a mismatch mafia aborts before even running the script. Changed to pass.
  • Previous value information was omitted from the CLI output for deletions -- reversions and edits would print old and new values but deletions were only printing property names. Add previous value information to that output, as advertised.
Rather than bother you with "hash mismatch" messages and prompt you to reload, I'm considering simply automatically reloading. Would that irk anyone?

Enjoy!
 

zarqon

Well-known member
A Note About Documentation

Prefref Plus allows users to add documentation for any setting or property (including mafia properties), which could prove quite handy eventually as more documentation is added. Presently it's a bit inconvenient as you need to manually edit vars_documentation.txt and upload the changes to the Map Manager, but it is possible. It's a string[string, string] map where the indices are <source>, <property name>, where the source is one of ZLib, global, or user. I appreciate any and all help in adding documentation for everything.

Somewhere down the pike I'm going to add a version of setvar() to ZLib that allows the script author to populate the documentation at the time the setting is initialized, but that's not realistically happening in the near future.
 

zarqon

Well-known member
Thanks Lyft! Hope it's useful for you.

I recently scraped the Wiki for noncombat titles and added all of them as the documentation for the corresponding choiceAdventure properties. It doesn't explain what any of them are or possible options yet, but it's a start!
 

fronobulax

Developer
Staff member
I'll claim stupidity.

I cannot figure out how to change a value. The attached screen shot can be a reference although some of the highlighting was added by the weirdness I went through to keep the popup displayed while I grabbed the screen.Capture.PNG

Clicking in the red box, left or right, seems to do nothing. Highlighting the value doesn't seem to let keyboard commands interact. Firefox Quantum 61.0.1. There are a couple of addins but disabling them does not solve my problem.

So

I hover over the name in Type Name.
I get the popup with value, default status and documentation.
I press shift and hold shift to keep the popup on the screen.

Now what?

Thanks.
 

zarqon

Well-known member
To edit a value, click the setting's current value in the table itself (not in the popup). Most of the time, unless there's something obviously interactive to do in the popup box, you shouldn't need to hold down Shift.

However, the stupidity is not entirely yours! If you have a small screen or have filtered the items down to just a few, as in your screenshot, the popup may obscure the value you need to click. This is a design flaw. I should probably make the popup only pop up when mousing over settings names, rather than also their values.
 
Top