elanthia-online / illthorn

Electron-based FE
18 stars 10 forks source link

Save Command History to Storage #137

Closed chriscoyier closed 3 years ago

chriscoyier commented 3 years ago

For this: https://github.com/elanthia-online/illthorn/issues/13

Not working great now. The biggest problem (and this came up with Thoughts storage too) is that I'm not sure the best way to know the Character name (which I think is a good unique identifier for storage) at certain points in the code. So I resort to asking the DOM for it, which is bad enough as is, but in my first commit here, I even setTimeout for a bit because the DOM doesn't know it yet in time for the CLI constructor.

It does "work" though, except that it doesn't seem to be loading back in a command history on a per-session basis as it should, but instead loading in the same buffer for everyone.

ondreian commented 3 years ago

Session.current.name is the best way to find the current session.

I'm unsure if these need to be grouped by the name though, I've been thinking a lot about this, and you can basically have a significantly larger pool of autocomplete options if they are not binned by name, and I am not sure how functionally useful the commands being silo'd is.

chriscoyier commented 3 years ago

I'm unsure if these need to be grouped by the name though, I've been thinking a lot about this, and you can basically have a significantly larger pool of autocomplete options if they are not binned by name

I'm fine with that. Especially because it's philosophically aligned with your thing about the CLI not clearing itself when you change between accounts. Like commands can be character-sharable.

I am not sure how functionally useful the commands being silo'd is.

My only thinking with the silo'ing is that they (I think!) are silo'd when you are in a session. So when I'm playing one character, and I can always count on that "up arrow" being something that this character actually did. But then if I refresh the client, all the sudden that "up arrow" has stuff in it from other characters. But the "larger pool" does mean that if I start typing, the chances of a useful autocomplete coming up is higher, which is good, so let's just ship that for now.