Interesting! The converter might need a little tightening… looking at the demo game, in Frotz I get “object#x” output that doesn’t show up in Parchment, and in Ozmoo I get Choix non reconnu, veuillez recommencer. even for valid input, which seems relevant since “a ton of retro computers” is mentioned as one of the points of I6 output.
Update: In Ozmoo, it rejects the regular 1/2 numbers until it gets a different kind of invalid input. Simply entering >a is enough to fix the problem and allow the game to continue. However, the game will later crash with a stack full (Ozmoo fatal error #6) message.
I am the author of Moiki. To be more descriptive, Moiki is a webapp (only in French for the moment) that allows you to create stories with choices in a simple way (aka, no script).
I did few exports including ink, twee, pdf (to create a kind of cyoa book) and now inform6!
As @jcompton pointed out, there were a lot of issues: sweat_smile: but they’re fixed now.
In addition, the generated code has become very light and can be compiled in version z5 or z3.
Oh, the reason is: in English all these words are 4 characters long and this was handy for my code
Anyway, my next step is to add a personalization page in the generator. From this page I will put some options to localize the hardcoded strings (like “Gagné” or “Cette commande est inconnue” etc.). I hadn’t thought of it, but I will be able to add localization for the menu commands.
Thank you.
Your getInputChoice() function could be much simpler using the dictionary rather than testing letter by letter input. But you may have good reasons to do it this way.
In fact, I’m just a newbie in inform, so, if you have an advice / sample on how you will do it I can implement it in a better way. I don’t know how the dictionary is working…
I’ll take a look at that. It’s pretty close to what I’ve already done: La mort bleue, La caverne des Morlocks
You’re targeting Z-code v3, v5, v8 and GLULX?
Thanks, I will have a look. Until now, I’m targeting only zcode v3/v5. Maybe one day I will look around GLULX…, but I have some features I want to implement in my editor (and in all the exporters) before that.
Interresting! Thank you for this sample, the concept is clear.
On my side, I changed my exporter to generate 2 files : a .inf with all the strings as constants and a .h with all the “hidden work”.
Now, I can give a custom name to the commands, (eg.: Constant HELP = "HELP";)
It’s great, because it allows final users to easily tweak the generated code.
To make the “getInputChoice” correctly match command names (that are given dynamically now), I need to compare the string (eg. “HELP”) with the content of the buffer that store user inputs. So far, it works well, even if the code is a little bit verbose.
To implement your solution, I’m not sure how I will convert “HELP” like strings, to ‘help’, but I will have a look.
I’ve updated all z3/z5 export demos and the sample source .zip file if you’re still curious (same links).
Don’t define your constants as strings of characters, but as words from the dictionary: ‘aide’, ‘liste’ etc.
Code
!% -Cu
!% -~S
!% $OMIT_UNUSED_ROUTINES=1
Constant STR_CMD_HELP = 'aide';
Constant STR_CMD_LIST = 'liste';
Array Storage->32;
! From inform 6.12 library
[ UpperCase c; ! for ZSCII matching ISO 8859-1
switch (c) {
'a' to 'z': c = c - 32;
201, 203, 211, 213, 220: c++;
215, 216: c = c + 2;
155 to 157, 164, 165, 205 to 207: c = c + 3;
181 to 185, 191 to 195: c = c + 5;
169 to 174: c = c + 6;
}
return c;
];
[ wputs w i;
@output_stream 3 Storage;
print (address) w;
@output_stream -3;
for (i = 0 : i < Storage-->0 : i++)
print (char) UpperCase(Storage->(i+2));
];
[ Main;
wputs(STR_CMD_HELP);
new_line;
wputs(STR_CMD_LIST);
];
Edit:
Why not make a constant text and a constant dictionary:
Constant STR_CMD_HELP = “AIDE”;
Constant STR_DICT_HELP = ‘aide’;
Edit: Array Storage->32; Byte instead of Word.
Oooh! Nice, I will certainly give it a try! Thanks!
I’m not really a fan of the solution which uses two constants because it forces the end user to be more vigilant. I might have to compare the two versions to see which is more advantageous in memory.