jasonlttl / iphonefrotz

Automatically exported from code.google.com/p/iphonefrotz
Other
0 stars 0 forks source link

Fine-tuning auto-complete #213

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Auto-complete is a wondrous thing, and I have only a couple of suggestions for 
it.

1) Including SEA(rch), an oft-used verb in some games!

2) The possibility of creating custom-made auto-complete lists. The main use of 
this would be for foreign games. You're not expected to keep track of an 
auto-complete for english, french, spanish, english, german games - but the 
user might be willing to make such a list him/herself! And then it would only 
be a matter of selecting the appropriate auto-comp list.

Original issue reported on code.google.com by ilprimoc...@gmail.com on 9 Mar 2013 at 11:07

GoogleCodeExporter commented 9 years ago
On second thought, regarding 1), SEAR(ch) would be better, as "sea" is 
relatively likely to be a game item, and is for many games. Whereas "sear" as a 
verb is uncommon - I don't recall seeing it used exclusively yet.

On a related note, could you please change "MEMO(rize)" to "MEMOR(ize)" 
instead? More games than you'd think have a "memo" item, and more than once 
I've typed "x memo" or "show memo", just to have iFrotz then convert it to 
"examine memorize" and "show memorize".

Original comment by ilprimoc...@gmail.com on 10 Mar 2013 at 4:16

GoogleCodeExporter commented 9 years ago
Actually, I was thinking of maybe marking some completions as "verb only" or 
"noun only", so that they would only work if they are at the beginning of a 
sentence, or not, respectively.  This would allow one to use "sea" for "search" 
and "mem" for "memorize" or "memo", depending on placement.

Original comment by spath...@gmail.com on 10 Mar 2013 at 8:04

GoogleCodeExporter commented 9 years ago
That seems like a great idea! It might even ease the way one plays "Counterfeit 
Monkey". In that game, an oft-used command, is, say, "remove x from codex". 
With your suggestion, it wouldn't autocomplete the "x", therefore elliminating 
the possibly aggravating "remove examine from codex".

I foresee no complications with existing games but, as you've noticed, I play a 
lot. So if I should notice anything untoward I'd let you know.

Original comment by ilprimoc...@gmail.com on 10 Mar 2013 at 10:17

GoogleCodeExporter commented 9 years ago
Just want to add that the more I play, the more I really wish I could tweak 
auto-complete. In some games I'd like to "rest", but it gets expanded to 
restore. Tables and desks are very common items, not auto-complete-a-ble. And 
then there are the other instances particular to each game.

I'm actually thinking... how feasible is it to have a customisable 
auto-complete and to have, say, a double-tap-hold on a word to add it to the 
list? I don't know how autocomplete really works, I mean, if the number of 
letters it looks through before coming up with a match is hardcoded then this 
won't really do, but if it's automated...

Original comment by ilprimoc...@gmail.com on 30 Mar 2013 at 11:16

GoogleCodeExporter commented 9 years ago
Something new to add to this.

I recently realised that Windows Frotz has a nifty, little-known feature - 
pressing TAB after typing in the first few letters of a word autocompletes it, 
if it's unambiguous. This works for, apparently, game items - scenery and nouns 
(I'd have to test more to be absolutely sure).

This would seem to indicate that somewhere in the game file there's an actual 
list of objects. Quick testing shows me that this is not room-sensitive (it's 
possible to autocomplete an item that's in another room), so it must be a 
global list, and that's why it has to be unambiguous (handy for long-winded 
item names).

I was wondering whether iFrotz could possibly make use of that list for 
autocomplete. Granted, it's less useful in iFrotz where we can just double-tap 
a word for inclusion into the command line, but I thought it was worth as least 
bringing up.

Original comment by ilprimoc...@gmail.com on 19 May 2014 at 9:06

GoogleCodeExporter commented 9 years ago
I've implemented the verb/noun distinction by placement, and added "search", 
"memo", and a few other things.
A complete overhaul of completion with user customization or game item 
autocomplete will have to wait for the rewrite.

Original comment by spath...@gmail.com on 4 Aug 2014 at 5:33

GoogleCodeExporter commented 9 years ago
I lied.  It turns out that the tab completion mechanism used by other versions 
of Frotz was really easy to hook into, so I've implemented this in iOS Frotz.

Some details:
0) This only works for Z-machine games
1) If the word is in the game's dictionary and can be uambiguously completed, 
it shows up as an autocomplete tip just like the other built-in words, and 
completes when you press space or return.
2) If multiple words in the game's dictionary match, the partial match is 
autocompleted, but the space used to accept the completion is not appended to 
the input line to signal you need to type more to disambiguate the rest of the 
word.
3) If the autocompleted word is the maximum character length of the game's 
dictionary (6 chars for Z3, 9 for Z4 are later), I personally think it looks 
bad because the completed word isn't a real word (it's possibly truncated). For 
example, in HHG you might get "examine improbabi drive".
To help this, Frotz looks back in the game scroll back for a word output by the 
game which matches the completion up to the maximum stored characters, and uses 
that word instead.  (It's possible there could be multiple words beginning with 
the same characters so it might not pick the right one, but I think this will 
be rare and in any case the game won't notice since it only tokenizes up to the 
dictionary word length).

I'm going to count this as a 'fix' for this issue for 1.7.  If you want you can 
create a new issue after 1.7 if you still  want further customization.  

Original comment by spath...@gmail.com on 5 Aug 2014 at 7:28

GoogleCodeExporter commented 9 years ago
Wow. That's... impressive. I'm not sure any further customization will be 
necessary, unless it's to help with non-English games... but, your method will 
already tap into the game's dictionary so it might catch that as well.

No, I don't think it'll need anything else. ;)

Original comment by ilprimoc...@gmail.com on 5 Aug 2014 at 9:02

GoogleCodeExporter commented 9 years ago
Well, there's still glulx games (for which I don't have dictionary support 
yet), and it's possible some non-English games might have words with common 
prefixes with built-in words that might make you type more than you should 
strictly have to to get the right completion… 
We'll see how it goes.

I'm not sure how easy/hard it would be to tap into glulx dictionaries.

Original comment by spath...@gmail.com on 5 Aug 2014 at 9:27

GoogleCodeExporter commented 9 years ago
So I thought glulxe dictionary completion would be hard because no other 
interpreter seems to have it.
And at first blush it actually seemed impossible because there is nothing in 
the game file header that tells you where the dictionary is located in memory, 
and the parser is completely written in IL compiled by Inform.
But it turns out Inform does always put the dictionary at the end of the game 
in a consistent format and I was able to write some heuristic code to find it, 
so I now have word completion working on glulxe games as well.

As an added bonus, if the game's dictionary (for either Z-machine or glulxe 
games)  does not contain the word "examine", I assume the game is non-English 
and automatically disable the built-in completion dictionary, so you only get 
the game's words.  That makes the non-prefix abbrevs "x", "g",and "z" not 
complete to their full forms either, but that's good, because it seems like 
some foreign games which don't understand "examine" or "again" still understand 
the one-letter shortcuts.

Original comment by spath...@gmail.com on 8 Aug 2014 at 9:19

GoogleCodeExporter commented 9 years ago
You're a genius. I could kiss you. Well, probably not, but I could certainly 
shake your hand vigorouosly and buy you a drink. Every day. For a few years.

"it seems like some foreign games which don't understand "examine" or "again" 
still understand the one-letter shortcuts."

You're entirely correct.

Original comment by ilprimoc...@gmail.com on 8 Aug 2014 at 10:55

GoogleCodeExporter commented 9 years ago

Original comment by spath...@gmail.com on 14 Aug 2014 at 7:48

GoogleCodeExporter commented 9 years ago
Fixed in release 1.7, now available (as soon as App Store servers update).

Original comment by spath...@gmail.com on 22 Aug 2014 at 4:21