Fallen London - Dressing Room extension [RETIRED]

[RETIRED]: As Failbetter added a great outfit-switching mechanic, I won’t be updating this extension any further.

[APPROVED]

From my first days amongst the throngs of Fallen London, I made much use of the overworked valet. However, as I grew weary of the clashing outfits that it would choose for me, I decided to explore another way to dress oneself.

The result of that exploration is The Fallen London - Dressing Room (Firefox or Chrome) (images). By clicking on the cosmogone-enhanced ‘Remember’ button, one can store the items that one is currently wearing under any label of your choice. Simply choosing the relevant label from the list allows one to change into any remembered outfit. Contrariwise, by clicking on the irrigo-soaked ‘Forget’ button, one can lose all memory of ever wearing such an abominable ensemble.

What is actually added?
On the ‘Myself’ tab, a button labeled ‘Dressing Room’ is added above the ‘Expanded Inventory’ button.

The ‘Dressing Room’ button opens a box with:

  • a text box for naming the current outfit being worn (below the ‘What am I wearing?’ prompt),[/li][li]a ‘Remember’ button to store the named outfit,[/li][li]a drop-down list box used to choose between stored outfits (below the ‘What to wear?’ prompt),[/li][li]a ‘Change’ button to switch to the selected outfit, and[/li][li]a ‘Forget’ button to delete the currently chosen outfit in the list box.

Updates
1.1 [ul][li]Added sanity-check for ownership of items before trying to equip.[/li][/ul]
1.2 [ul][li]Added mechanisms so that the Expanded Inventory items can be saved and loaded alongside the rest of your items.[/li][li]Changed the ‘Remember’ button so that it will cause an update of the currently selected outfit if a new outfit name is not provided.[/li][li]Changed the database to be persistent to avoid possible deletion by browsers. As a consequence of this change, your browser may ask for permission to store the database.[/li][/ul]
1.21 [ul][li]Added case-insensitive alphabetization to outfit options.[/li][/ul]
1.30 [ul][li]Optimized changing outfits based on a contribution from marcmagus.[/li][/ul]
1.40 [ul][li]Added a dialog box that stays in place while an outfit is being changed[/li][/ul]
1.41 [ul][li]Added a ‘change’ button so that an outfit can be selected without changing into it.[/li][/ul]
Notes
This extension has primarily been tested in version 41.0 of Firefox.

To install in Firefox with the Greasemonkey add-on installed, one can simply go to the link provided and choose the ‘Install this script’ button on the page.

This extension uses a database to store your outfits. To find the database, consult the following: Where is the data stored?
edited by Travers on 10/28/2015

Yes, please. This is the service I always wished the valet would provide.

It seems to install with Chrome/Tampermonkey, will report back if I notice anything.

ETA: Note to other players, the Dressing Room only covers the Standard Inventory, not the Expanded Inventory. (Note to Travers, including the other might be a desirable feature to add in the future)
edited by marcmagus on 8/20/2015

Very nice! It looks like it works with the standard inventory and not the expanded page of the inventory, right? Any plans to add that? (I know it was the trickier part for the Valet as well, manual switching required…)

Thanks for the nice comments!

I uploaded a new version with some added sanity-checking to prevent a possible inconsistency (i.e., trying to wear an item that you just sold). For the future, I’m working on 1) saving the items from the Expanded Inventory as part of your outfit and 2) allowing the ‘Remember’ button to cause an update of a stored outfit when an outfit name is selected in the list box but a new outfit name is not provided. At the moment, to update an outfit, one must forget the old outfit and remember the new outfit.

If there are any other improvements/additions that are desired, let me know! I plan on working on this project for a while.

I love it! So efficient.

I installed it in Chrome and it seems to be working fine, but I’m having some trouble in Firefox. (Version 31.7.0, Scriptish extension, I can see the Dressing Room button and save outfits, but trying to change outfits doesn’t seem to do anything.)

I’m sorry that it isn’t working in version 31.7.0 of Firefox. I’ve only tested it in version 40.0.2.

I just posted version 1.2. The most notable change is support for the Expanded Inventory. The Dressing Room should now function for all of the equippable item categories. Also, as I changed the database setup, databases from the earlier version will probably not be and probably shouldn’t be read.

If changing outfits seems too slow in this version, it could be because I added a rather crufty mechanism to slow the process down to decrease visual glitches (i.e., the old item still appearing to be equipped but the stats for the new item applying). If you want to change this, you can search the code for my ‘crufty’ comment and change the numbers in the setTimeout calls below it (e.g., change 8000 to 2000). Or, if you prefer, you can just delete the two setTimeout lines as the extension can function without them.

Is there any chance of this extension to become integrated into vanilla Fallen London? It’s so handy, I feel like it should be standard issue.

My dressing room can’t remember outfits. It worked until the last update (1.2), but now when I press remember it just flicks from standard to expanded and back. I’m on chrome using tampermonkey.

This is just what I’ve been hoping for, what my Valet never supplied. There’s a default outfit that I like to wear when I’m not optimising for one thing or another, and this is perfect for switching back to it.

I also love the effect where, when changing outfits, my inventory flips from Standard to Expanded to Standard again (or vice-versa). It just makes it more enjoyable to switch outfits!

EDIT: I do have one qualm though, my outfits aren’t being organised alphabetically.
edited by Cecil on 8/22/2015

Thanks for the report. I’ll start testing on Chrome to see if I can figure this out.

I didn’t write code to do alphabetization since my results from the database are always alphabetized. It must be difference in setups (Firefox 40.0.2, Greasemonkey 3.3, Windows 8). I will fix this in the next version. Thanks for reporting this.

Update 1: I was looking into this but, from all of my documentation, it seems that the database should be returning the results in ascending order based on ASCII. Are the out of order outfits using lower case vs upper case first letters? In ASCII, all upper case letters come before the lower case letters (i.e., ‘Z’ comes before lower case ‘a’).

Update 2: I assumed that it was the ASCII ordering that you noticed so I added case-insensitive alphabetization in version 1.21.
edited by Travers on 8/22/2015

From this document, I found out that Chrome does not yet offer persistent storage for the database that I’m using: &quotPersistent storage … will eventually be available to other offline APIs like IndexedDB&quot.

If you aren’t worried about your browser possibly deleting your outfits when it needs space, you can quickly fix the ‘Dressing Room’ for Chrome.

Replace this line:

var req = window.indexedDB.open(DB_NAME, {version: DB_VERSION, storage: &quotpersistent&quot});

With this line:

var req = window.indexedDB.open(DB_NAME,  DB_VERSION);

With this change it seems to work in Chrome 44.0.2403.157 but I haven’t heavily tested it.

[quote=Travers]Update 1: I was looking into this but, from all of my documentation, it seems that the database should be returning the results in ascending order based on ASCII. Are the out of order outfits using lower case vs upper case first letters? In ASCII, all upper case letters come before the lower case letters (i.e., ‘Z’ comes before lower case ‘a’).

Update 2: I assumed that it was the ASCII ordering that you noticed so I added case-insensitive alphabetization in version 1.21.
edited by Travers on 8/22/2015[/quote]

Just tested with a few more outfits, and yes, in version 1.2 I am experiencing case-sensative alphabetization.
edited by Cecil on 8/22/2015

From this document, I found out that Chrome does not yet offer persistent storage for the database that I’m using: &quotPersistent storage … will eventually be available to other offline APIs like IndexedDB&quot.

If you aren’t worried about your browser possibly deleting your outfits when it needs space, you can quickly fix the ‘Dressing Room’ for Chrome.

Replace this line:

var req = window.indexedDB.open(DB_NAME, {version: DB_VERSION, storage: &quotpersistent&quot});

With this line:

var req = window.indexedDB.open(DB_NAME,  DB_VERSION);

With this change it seems to work in Chrome 44.0.2403.157 but I haven’t heavily tested it.[/quote]

Did this, It worked, You’re brilliant.

Updated my Chrome and Dressing Room stopped working all of a sudden, and now I’m experiencing the same issue Eru Illuvatar mentioned. I’m a total layman when it comes to coding, so… where exactly do I replace that line?

Enter tampermonkey (‘dashboard’). Open the ‘fallen London Dressing Room’. Click ‘Search’, then search for this line:
[color=rgb(119, 119, 170)]var req = window.indexedDB.open(DB_NAME, {version: DB_VERSION, storage: &quotpersistent&quot});[/color]
Delete it and replace it with this line:
[color=rgb(119, 119, 170)]var req = window.indexedDB.open(DB_NAME, DB_VERSION);[/color]
Then click the save icon (found above the search button)

I’m sorry that it isn’t working in version 31.7.0 of Firefox. I’ve only tested it in version 40.0.2.[/quote]

I can’t update FF on the computer I tried it on, but good to know it should work on my other computer (where I can update)! Thanks for your hard work. I’m using it when I’m playing in Chrome and loving it.

Feature Requests:

I’ve noticed that it takes quite a while to change outfits, which is a bit unsurprising given that a message has to go out to the game for each item, and that behavior is a bit weird if I get impatient and try to do something while my outfit is being changed.

Suggestion 1, optimization: As checking my current equipment is cheap, and changing my equipment is expensive, check for each item if it’s already equipped before signalling to equip it. Since most of my outfits aren’t changing things on the expanded inventory, this will result in signficant savings.

If I understand your code correctly, it looks like the following would work:

[code] if (record.Hat != ‘-’ && record.Hat in itemsOwned && record.Hat != outfit.Hat)

    else if (record.Hat == '-' && outfit.Hat != '-')

[/code]

Suggestion 2, QoL UI: Pop up a small &quotChanging…&quot dialog, hook in a listener that waits for a positive response from FL to hide the dialog. (Worse: sleep 1s, check if the outfit is now correct, loop)

[quote=marcmagus]Suggestion 1, optimization: As checking my current equipment is cheap, and changing my equipment is expensive, check for each item if it’s already equipped before signalling to equip it. Since most of my outfits aren’t changing things on the expanded inventory, this will result in signficant savings.

If I understand your code correctly, it looks like the following would work:

[code] if (record.Hat != ‘-’ && record.Hat in itemsOwned && record.Hat != outfit.Hat)

    else if (record.Hat == '-' && outfit.Hat != '-')

[/code] [/quote]Great suggestion! I made this change in version 1.30. I did the second test differently to not change the current behavior:

else if (outfit.Hat != '-' && record.Hat != outfit.Hat)

If you’re curious, the main difference is that, if you no longer own the item that you are trying to equip in a slot, it will unequip the current item in the slot. I prefer this to leaving the old item in the slot since it is more obvious that it tried to equip at least.

[quote=marcmagus]Suggestion 2, QoL UI: Pop up a small &quotChanging…&quot dialog, hook in a listener that waits for a positive response from FL to hide the dialog. (Worse: sleep 1s, check if the outfit is now correct, loop)[/quote]I’ll look into this and see if there are any good ‘hooks’. If not, I can just do as you suggested in the ‘worse’ case and flip frames once every second to see if the outfit is correct.
Update: I added a simple version of the dialog (i.e., the ‘worse’ option) in version 1.40. I haven’t heavily tested it yet but it seems to be working.
edited by Travers on 8/30/2015