Ceci est une ancienne révision du document !
static int Parser.FindWordID(string motATrouver)Cherche motATrouver dans le dictionnaire du parser, et retourne son numéro ID.
if (Parser.FindWordID("machine") > 0) { Display("machine se trouve dans le dictionnaire du jeu"); }
affichera le message si le dictionnaire du jeu inclut le mot “machine”.
Compatibility: Supported by AGS 3.1.0 and later versions.
Voir aussi : Parser.ParseText
static Parser.ParseText(string texte)Stocke le texte spécifié pour être utilisé plus tard par Said. Vous devez d'abord appeler cette commande avec l'entrée de l'utilisateur avant d'utiliser la commande Said. Vous l'utiliserez certainement à l'intérieur de la fonction interface_click lorsque votre Fonctions et propriétés des zones de saisie de GUI (Text Box) est activée.
String commande = txtParser.Text; Parser.ParseText(commande);
récupérera le texte saisi par le joueur et le stockera dans la chaîne “commande” pour une utilisation ultérieure avec la commande Said.
Voir aussi : Parser.FindWordID,
Parser.Said
static bool Parser.Said(string text)Checks whether the player typed in TEXT in their input passed to ParseText. Returns true if it matches, false otherwise.
Example:
String input = txtParserInput.Text; Parser.ParseText(input); if (Parser.Said("load")) { txtParserInput.Text = ""; RestoreGameDialog(); }
will bring up the restore game dialogue if the player types “load” in the text parser.
Voir aussi : Parser.ParseText, Parser.SaidUnknownWord
static String Parser.SaidUnknownWord()If a word not in the game dictionary was submitted to the last ParseText call, then the word is returned by this command. This allows you to display a message like “Sorry, this game doesn't recognise 'XXXX'.”
String badWord = Parser.SaidUnknownWord(); if (badWord != null) Display("You can't use '%s' in this game.", badWord);
will display the message if the player types a word that's not in the vocabulary.
Voir aussi : Parser.ParseText, Parser.Said