In Turkish “Look to window” is “Pencereye bak” Pencere is the object and “ye” is preposition “to”
So I just wrote:
Understand “[something]ye bak” as examining.
But in the parser it doesn’t understand without the empty space.
It only understands when I enter: “Pencere ye bak” while it must be “pencereye bak” actually.
How can I make Inform understand the object without the empty space between Pencere and ye? Is it possible?
Look to window is a bit silly, right I wanted to know if I can merge the preposition and noun or not.
So in English it would be a command like :
doorto touch which must be understood by inform as Touch to door. I checked the extensions (spanish) but basicly its like english, prepositions are separated.
another thought, could I name one object with two names referring to the same object? in this case: doorto and door would be the same object, is there an easy way to define this?
well Inform replied my question :
"The sentence ‘windowto is window’ appears to say two things are the same - I am reading ‘windowto’ and ‘window’ as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that ‘Antony is Cleopatra’. "
but for example:
how can we call something with a different name?
jack is in the room.
jack is a boy.
and I’d like to give a command like: talk to the boy. (referring to jack)
Touch to door makes no more sense to me than look to window. I can’t help you translate if I don’t know the related English phrase.
What is the action? It would see to be you want to code for examine or look.
The object us window, so there are two things you can do…
look through window
look at window
…and if the window is in a particular direction (like south), you can…
look south
…and this could be redirected to…
look through window
…but your use of “to” is not at all clear.
Okay so I think I know where you’re going. In Turkish, you combine two words into one for meaning. Inform is going to struggle with that since it expects words to be space delimited. You could check the entered command, loop through the words and look for proposition suffixes and break them out for the parser.
Admittedly, there are better people to answer this question so I’m going to run away now.
Thank you David, that was actually where I am going. Meanings don’t matter at all.
So I thought maybe for all the objects I created in the world, I can give a unique kind, so the parser could use both names of the object with a verb. But I don’t know if it’s possible. Although this is a horrible solution, all I want is to create a turkish game And unfortunately, there is no way to omit the suffixes for parser, because sometimes suffixes change the root word in turkish. So, its a hopeless cause but maybe I can use brute force in this case.
You always have to call the window “the window” in your source code, but lines like this mean that the player can type “windowto” and the game will understand that this means the window. (And “Understand” lines can do a lot more than this; the chapter in the documentation on “Understanding” is well worth reading.)
One thing you might try is modifying the player’s command to put a space in it before “ye.” Something like this might help:
After reading a command:
let temporary be indexed text;
now temporary is the player's command;
replace the regular expression "ye\b" in temporary with " ye";
change the text of the player's command to temporary.
This is supposed to take every word that ends with “ye” and put a space in front of it before the parser goes to work on the command. Then your command will be “Pencere ye bak” and you can understand “Pencere” separately.
[The way it works, if it works: “After reading a command” and the rules for changing the player’s command are in section 17.31 of the documentation. The rules for replacing text using regular expressions are in 19.8. And the syntax for the regular expressions is in 19.6 – that’s where you can see that “\b” makes sure that the text is occurring at the end of the word.]
There are some complications here; if there are ordinary words that end with “ye” they’ll get split up to (if we tried to do this in English, “potato” would become “pota to”). And this doesn’t do anything about suffixes that change the root word.
But a bigger problem that you might have is that it sounds like the noun comes first in Turkish. I think Inform does a lot of things that depend on commands starting with verbs most of the time, and it might be hard to work around them. Maybe this is something where the other foreign-language extensions could help (I don’t know if any of them are noun-first).
Hmm. Suffixes/enclitics in Inform’s parser is a tough one. I would suggest using an After reading a command rule as matt w suggested, but with an additional check on the verb. As the suffix won’t be used with every verb, this should help reduce the number of cases when it mistakenly detaches “ye”.
Is it possible to only run the rule if the parser failed to match the noun?
Matt, Dannii thank you! I’m very new at this, and it will be a very good start for me. I believe I can make simple games just using the Understand command and even better if I can separate the suffix from the player command, I don’t have to worry about changing roots, because Understand…as will work again. great
If that helps, in French too we need to separate words from each other to parse them better (lion d’Afrique -> lion d’ Afrique -> lion de Afrique). The nouns don’t come first, though, but this might be fixable by reversing the orders of the words manually, for instance in the LanguageToInformese routine (cf DM4 par. 36 part III.1 ?). However I have no idea how you do it in Inform 7, so this advice might not really be helpful!
I must check the French translation. But may I ask you in French translation is it possible using the letters Œ, œ ? or you type Oe oe? Right now Ive heard a very bad news about Unicode… and I have 4 unicode letters in the alphabet…
Hum, good question! As a player I have never inputted characters that are not on my keyboard, and French keyboards don’t have the œ key! ^^ So I just type oe…
However I think that (at least for the French parser) the Inform parser is configured to get rid of accented letters by default, ie the parser transforms ‘vérité’ in ‘verite’, and then tries to match it to an object. In my games, for an object to be recognized, I have to give all its synonyms without accents. I don’t know what happens for other characters, though - I would guess the parser either doesn’t recognize œ, or it does and transforms it to ‘oe’ before matching it to words, but that’s a wild guess. It’d be interesting to check it out!
The œ character should be part of the default table for Inform, though ; see the ‘Higher ZSCII’ table here : inform-fiction.org/manual/html/tables.html#tbl2b. If your letter is here, it should be loaded in the default Zcharacter table and you should be able to use it ; if not you’ll have to add them manually, by adding at the beginning of your code :
Zcharacter table + '@{unicode}';
where ‘unicode’ is the unicode corresponding to your letter. (At least I think that’s how it works!)
The Inform compiler assumes that the game dictionary is single-byte characters. I7 is not set up to deal with that Zcharacter directive (which doesn’t appear in Glulx anyhow).
I have an experimental extension that allows the parser to deal with 32-bit characters, so that Unicode parsing works. However, since the compiler still doesn’t understand that format, you have to use awkward workarounds to set up synonyms.
Inform really isn’t (currently at least) set up to handle case inflection of nouns. And there are lots of these in Turkish, I gather. You might wish to study the German translation to see how they handle the case system of German!
I’ve seen the Swedish extension and the Unicode Parser, which is great for using foreign words but not practical for many words I suppose. So how can I do that conversion/reducing for inputted characters?
I want Inform understand the inputted Ş as S for example.
by the way I’m a fan of Shade I’d love to translate it into turkish also one day if you let just to make IF more popular here.
This is straight out of the Advanced Text chapter, so you probably got it already, but this works:
Include Unicode Parser by Andrew Plotkin.
The Kitchen is a room.
The player carries a spoon.
After reading a command:
let T be indexed text;
let T be the player's command;
replace the text "ş" in T with "s";
replace the text "Ş" in T with "s";
change the text of the player's command to T.
The “reading a command” activity occurs before the buffer is lower-cased (in Glulx projects). So we have to check both cases here.