Bonjour à tous, notre team est en train de développer un petit jeu en pascal et nous avons un problème dans une procédure. Nous devons comparer 2 strings avec une structure if mais problème : le compilateur renvoie comme erreur que les strings ne sont pas des valeurs booléennes, ce que nous savons. Comment fait-on pour valider ces strings ?
merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 procedure Cheat_code; begin vide_ecran; case langue of 1:writeln('Please enter your cheat code'); 2:writeln('S''il-vous-plait entrer votre code de triche'); end; readln(entercheat); entercheat:=uppercase(entercheat); if (entercheat):=(all_guns) then choix = 1 else if (entercheat):=(gods) then choix = 2 else if (entercheat):=(clip) then choix = 3 else choix = 0; vide_ecran; case langue of 1: begin case choix of 1: begin cheaton.all_gun:=1; writeln('!!! LOCK AND LOADED !!!'); end; 2: begin cheaton.god:=1; writeln('You are now as powerful as the gods'); end; 3: begin cheaton.clipping:=1; writeln('Walls are now made of air...hehehe'); end; else writeln('!!! INVALID CHEAT CODE !!!') end; end; 2: begin case choix of 1: begin cheaton.all_gun:=1; writeln('Vous etes pret et tres bien equipper'); end; 2: begin cheaton.god:=1; writeln('Vous etes aussi puissant que les Dieux'); end; 3: begin cheaton.clipping:=1; writeln('Les murs ne sont plus un obstacle pour vous...hehehe'); end; else writeln('!!! CODE DE TRICHE INVALIDE !!!') end; end; //potnkfa : All gun //potndqd : God //potnSPISPOPD : No clipping end; end;
Partager