Je suis en train de programmer un RPG sous Inform 7 et comme il se doit, avec création de personnage en début de partie. Sexe, caractéristiques, compétences, etc.
J’aimerais permettre au joueur de choisir son nom. Qu’il soit affiché ensuite durant le jeu, lorsqu’il regarde son passeport ou que sais je.
Et je n’ai la MOINDRE idée, pas le plus petit début d’idée, de comment faire.
En I6 y’a une commande « changePlayer(object) » : tu crées un objet « object » avec un nom et une description, et tu transmutes le joueur à l’intérieur, ce qui fait que la réponse à « > x moi » (par exemple) sera la description qui fut attribuée à l’objet. Peut-être y’a-t-il une commande comme ça (pour « changer le joueur de corps ») pour I7 ? Désolé de ne pas pouvoir aider un peu plus, je ne connais pas I7 !
j’ai enfin retrouvé, dans l’exemple 405 du manuel :
[code]« Identity Theft »
The player’s forename is an indexed text that varies. The player’s full name is an indexed text that varies.
When play begins:
now the command prompt is "What is your name? > ".
To decide whether collecting names:
if the command prompt is "What is your name? > ", yes;
no.
After reading a command when collecting names:
if the number of words in the player’s command is greater than 5:
say « [paragraph break]Who are you, a member of the British royal family? No one has that many names. Let’s try this again. »;
reject the player’s command;
now the player’s full name is the player’s command;
now the player’s forename is word number 1 in the player’s command;
now the command prompt is « > »;
say « Hi, [player’s forename]![paragraph break] »;
say « [banner text] »;
move the player to the location;
reject the player’s command.
[We also want to postpone the proper beginning of the game until we’ve gotten the name:]
Instead of looking when collecting names: do nothing.
Rule for printing the banner text when collecting names: do nothing.
Rule for constructing the status line when collecting names: do nothing.
Your Bedroom is a room. The printed name of Your Bedroom is « [player’s forename]'s Bedroom ».
The player carries a letter. The description of the letter is « Dear [player’s full name], [paragraph break]You have won the Norwegian Daily Lottery! … ».
[/code]