J’ai entièrement recodé un système d’écoulement pour mon jeu, n’étant pas satisfait de celui « de base » dans Inform (j’ai besoin de souvent faire passer plusieurs heures ingame, d’un seul coup, et ça prend un temps INTERMINABLE, même sans aucun « événement » pendant l’attente ; rien qu’avec la « turn sequence rule »).
Bref pour ceux que ça peut intéresser, voici mon truc, qui gère le passage des secondes, minutes, heures, jours de la semaine, mois, années…
[code]Book - Fondamentaux
NightState is a truth state that varies. NightState is false.
DayState is a truth state that varies. DayState is false.
Janvier is a truth state that varies. Janvier is false.
Février is a truth state that varies. Février is false.
Mars is a truth state that varies. Mars is false.
Avril is a truth state that varies. Avril is false.
Mai is a truth state that varies. Mai is false.
Juin is a truth state that varies. Juin is false.
Juillet is a truth state that varies. Juillet is false.
Août is a truth state that varies. Août is false.
Septembre is a truth state that varies. Septembre is false.
Octobre is a truth state that varies. Octobre is false.
Novembre is a truth state that varies. Novembre is false.
Décembre is a truth state that varies. Décembre is false.
Lundi is a truth state that varies. Lundi is false.
Mardi is a truth state that varies. Mardi is false.
Mercredi is a truth state that varies. Mercredi is false.
Jeudi is a truth state that varies. Jeudi is false.
Vendredi is a truth state that varies. Vendredi is false.
Samedi is a truth state that varies. Samedi is false.
Dimanche is a truth state that varies. Dimanche is false.
NuitLundiMardi is a truth state that varies. NuitLundiMardi is false.
NuitMardiMercredi is a truth state that varies. NuitMardiMercredi is false.
NuitMercrediJeudi is a truth state that varies. NuitMercrediJeudi is false.
NuitJeudiVendredi is a truth state that varies. NuitJeudiVendredi is false.
NuitVendrediSamedi is a truth state that varies. NuitVendrediSamedi is false.
NuitSamediDimanche is a truth state that varies. NuitSamediDimanche is false.
NuitDimancheLundi is a truth state that varies. NuitDimancheLundi is false.
The DayTime is a number variable. [ heure ]
The DayTimeMinutes is a number variable. [ minutes ]
The DayTimeSecondes is a number variable. [ minutes ]
The MonthDay is a number variable. [ jour dans le mois ]
The Year is a number variable.
The YearDay is a number variable. [ jour dans l’année ]
The DayAbsolu is a number variable. [ jour dans l’année ]
To say StefTime :
say « [if DayTime is less than 10]0[end if][DayTime]h[if DayTimeMinutes is less than 10]0[end if][DayTimeMinutes] et [DayTimeSecondes] secondes ».
To say WeekDay :
say « [if Lundi is true]Lundi[otherwise if NuitLundiMardi is true]Nuit de Lundi à Mardi[otherwise if Mardi is true]Mardi[otherwise if NuitMardiMercredi is true]Nuit de Mardi à Mercredi[otherwise if Mercredi is true]Mercredi[otherwise if NuitMercrediJeudi is true]Nuit de Mercredi à Jeudi[otherwise if Jeudi is true]Jeudi[otherwise if NuitJeudiVendredi is true]Nuit de Jeudi à Vendredi[otherwise if Vendredi is true]Vendredi[otherwise if NuitVendrediSamedi is true]Nuit de Vendredi à Samedi[otherwise if Samedi is true]Samedi[otherwise if NuitSamediDimanche is true]Nuit de Samedi à Dimanche[otherwise if Dimanche is true]Dimanche[otherwise if NuitDimancheLundi is true]Nuit de Dimanche à Lundi[end if] ».
To say Month :
say « [if Janvier is true]Janvier[otherwise if Février is true]Février[otherwise if Mars is true]Mars[otherwise if Avril is true]Avril[otherwise if Mai is true]Mai[otherwise if Juin is true]Juin[otherwise if Juillet is true]Juillet[otherwise if Août is true]Août[otherwise if Septembre is true]Septembre[otherwise if Octobre is true]Octobre[otherwise if Novembre is true]Novembre[otherwise if Décembre is true]Décembre[end if] ».
Book - Part - Passage du temps à chaque action
Attente is a truth state that varies.
AttenteMinutes is a truth state that varies.
AttenteHours is a truth state that varies.
When play begins :
now Attente is false ;
now AttenteMinutes is false ;
now AttenteHours is false.
Before doing anything :
increment the DayTimeSecondes ;
if DayTimeSecondes is not less than 60
begin ;
[ PASSAGE DU TEMPS ]
decrease DayTimeSecondes by 60 ;
increment the DayTimeMinutes ; make the HourPassage ;
check the GameTime ;
end if.
To make the HourPassage :
if DayTimeMinutes is not less than 60
begin ;
[ PASSAGE DU TEMPS ]
decrease DayTimeMinutes by 60 ;
increment the DayTime ;
check the GameTime ;
end if.
Part - Waiting
Instead of waiting :
now the DayTimeSecondes is 0 ;
increment the DayTimeMinutes ;
if DayTimeMinutes is not less than 60
begin ;
decrease DayTimeMinutes by 60 ; increment the DayTime ; check the GameTime ;
end if ;
stop the action.
Part - Minuteswaiting
Minuteswaiting is an action applying to a number. Understand « attendre [a number] minutes » or « attendre [a number] minutes » as Minuteswaiting.
Instead of Minuteswaiting :
let N be the number understood ;
if N is less than 61
begin ;
now Attente is true ; now AttenteMinutes is true ;
repeat with T running from 1 to (the number understood - 1)
begin ;
if Attente is true
begin ;
increment the DayTimeMinutes ;
if DayTimeMinutes is not less than 60
begin ;
decrease DayTimeMinutes by 60 ; increment the DayTime ; check the GameTime ;
end if ;
end if ;
end repeat ;
check the GameTime ;
now Attente is false ; now AttenteMinutes is false ;
follow the turn sequence rules ; try looking ;
end if.
Part - Hourswaiting
Hourswaiting is an action applying to a number. Understand « attendre [a number] heures » or « attendre [a number] heure » as hourswaiting.
Instead of Hourswaiting :
let N be the number understood ;
now Attente is true ; now AttenteHours is true ;
clear the screen ; say « Vous attendez. » ; say the waitkey ; clear the screen ;
repeat with T running from 1 to the number understood multiplied by 60
begin ;
if Attente is true
begin ;
increment the DayTimeMinutes ;
if DayTimeMinutes is not less than 60
begin ;
decrease DayTimeMinutes by 60 ; increment the DayTime ; check the GameTime ;
end if ;
end if ;
end repeat ;
check the GameTime ;
now Attente is false ; now AttenteHours is false ;
follow the turn sequence rules ; try looking.
Book - Check the game time
To check the GameTime :
[ CYCLE DES 24H ]
if DayTime is not less than 25
begin ;
decrease DayTime by 24 ; increment the YearDay ; increment the MonthDay ;
end if ;
[ JOUR ET NUIT ]
if DayTime is not less than 6
begin ;
now DayState is true ; now NightState is false ;
end if ;
if DayTime is greater than 21
begin ;
now NightState is true ; now DayState is false ;
end if.
Book - Mécanisme de passage des mois, etc
To make the MonthsPass :
[ PASSAGE DES MOIS ]
if Janvier is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Janvier is false ; now Février is true ; now the MonthDay is 1 ;
end if ;
if Février is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 28
begin ;
now Février is false ; now Mars is true ; now the MonthDay is 1 ;
end if ;
if Mars is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Mars is false ; now Avril is true ; now the MonthDay is 1 ;
end if ;
if Avril is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 30
begin ;
now Avril is false ; now Mai is true ; now the MonthDay is 1 ;
end if ;
if Mai is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Mai is false ; now Juin is true ; now the MonthDay is 1 ;
end if ;
if Juin is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 30
begin ;
now Juin is false ; now Juillet is true ; now the MonthDay is 1 ;
end if ;
if Juillet is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Juillet is false ; now Août is true ; now the MonthDay is 1 ;
end if ;
if Août is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Août is false ; now Septembre is true ; now the MonthDay is 1 ;
end if ;
if Septembre is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 30
begin ;
now Septembre is false ; now Octobre is true ; now the MonthDay is 1 ;
end if ;
if Octobre is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Octobre is false ; now Novembre is true ; now the MonthDay is 1 ;
end if ;
if Novembre is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 30
begin ;
now Novembre is false ; now Décembre is true ; now the MonthDay is 1 ;
end if ;
if Décembre is true and the DayTime is 24 and the DayTimeMinutes is 59 and the MonthDay is 31
begin ;
now Décembre is false ; now Janvier is true ; now the MonthDay is 1 ;
end if ;
[ PASSAGE DES JOURS DE LA SEMAINE ]
[ LUNDI ]
if Lundi is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Lundi is false ; now NuitLundiMardi is true ;
end if ;
if NuitLundiMardi is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitLundiMardi is false ; now Mardi is true ;
end if ;
[ MARDI ]
if Mardi is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Mardi is false ; now NuitMardiMercredi is true ;
end if ;
if NuitMardiMercredi is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitMardiMercredi is false ; now Mercredi is true ;
end if ;
[ MERCREDI ]
if Mercredi is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Mercredi is false ; now NuitMercrediJeudi is true ;
end if ;
if NuitMercrediJeudi is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitMercrediJeudi is false ; now Jeudi is true ;
end if ;
[ JEUDI ]
if Jeudi is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Jeudi is false ; now NuitJeudiVendredi is true ;
end if ;
if NuitJeudiVendredi is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitJeudiVendredi is false ; now Vendredi is true ;
end if ;
[ VENDREDI ]
if Vendredi is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Vendredi is false ; now NuitVendrediSamedi is true ;
end if ;
if NuitVendrediSamedi is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitVendrediSamedi is false ; now Samedi is true ;
end if ;
[ SAMEDI ]
if Samedi is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Samedi is false ; now NuitSamediDimanche is true ;
end if ;
if NuitSamediDimanche is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitSamediDimanche is false ; now Dimanche is true ;
end if ;
[ DIMANCHE ]
if Dimanche is true and the DayTime is 24 and the DayTimeMinutes is 59
begin ;
now Dimanche is false ; now NuitDimancheLundi is true ;
end if ;
if NuitDimancheLundi is true and the DayTime is 5 and the DayTimeMinutes is 59
begin ;
now NuitDimancheLundi is false ; now Lundi is true ;
end if.
[/code]