[code]program KotorIIGameCalculator;
{$APPTYPE CONSOLE}
uses SysUtils;
type
LSORDS = array[1..2] of string;
SON = array [1..2] of string;
PRE = array [1..6] of string;
BC = array [1..3] of string;
PC = array [1..6] of string;
var
Alignment: LSORDS;
Change: SON;
PrestigeDS: PRE;
PrestigeLS: PRE;
BaseClass: BC;
Begin
Randomize;
Alignment[1]:= ('Dark Side');
Alignment[2]:= ('Light Side');
Change[1]:= ('No Change');
Change[2]:= ('Change');
BaseClass[1]:= ('Jedi Guardian');
BaseClass[2]:= ('Jedi Consular');
BaseClass[3]:= ('Jedi Sentinel');
PrestigeLS[1]:= ('Jedi Weapon Master');
PrestigeLS[2]:= ('Jedi Watchmen');
PrestigeLS[3]:= ('Jedi Master');
PrestigeDS[4]:= ('Sith Marauder');
PrestigeDS[5]:= ('Sith Assassin');
PrestigeDS[6]:= ('Sith Lord');
Writeln(Alignment[random(1)+1]);
Writeln;
Writeln(Change[random(1)+1]);
Writeln;
Writeln(BaseClass[random(2)+1]);
Writeln;
[highlight]If Alignment = [2] then
begin
Writeln(PrestigeDS[random(2)+1])
end
else
begin
Writeln(PrestigeLS[random(2)+1]);
end;[/highlight]
Readln;
end.[/code]
Basically I'm having problems with the highlighted section. I want to make it so that if you've picked Dark Side, you can only have a Dark Side prestige class. Having errors such as
[quote]Incompatible Types[/quote]
Any help appreciated
[CODE]
If Alignment = [2] then
begin
Writeln(PrestigeDS[random(2)+1])
end
else
begin
Writeln(PrestigeLS[random(2)+1]);
end;
[/CODE]
I think you forgot something:
[QUOTE]
If Alignment = [2] then
begin
Writeln(PrestigeDS[random(2)+1])[B][I];[/I][/B]
end
else
begin
Writeln(PrestigeLS[random(2)+1]);
end;
[/QUOTE]
Highlighted, on the third line.
Thanks, but the error I'm getting is on the
[code]If Alignment = [2] then[/code]
line. :frown:
[editline]10:26AM[/editline]
Changed it to
[code]If Alignment:= ('Dark Side') then[/code]
and I'm getting
[quote]Type of expression must be BOOLEAN[/quote]
How would I even incorporate boolean into the program? There must be a way to validate it without switching data types.
[code]var
AlignmentChoise: integer;
[...]
AlignmentChoise := random(1)+1;
Writeln(Alignment[alignmentchoise]);
Writeln;
[...]
If AlignmentChoise = 1 then
[...][/code]
Oh dude, where the heck did you learn Pascal?
[QUOTE=ZeekyHBomb;18005397][code]var
AlignmentChoise: integer;
[...]
AlignmentChoise := random(1)+1;
Writeln(Alignment[alignmentchoise]);
Writeln;
[...]
If AlignmentChoise = 1 then
[...][/code]
Oh dude, where the heck did you learn Pascal?[/QUOTE]
College, but we've only just started array work and I'm doing this on my own.
[QUOTE=Cypher_09;18005004]Thanks, but the error I'm getting is on the
[code]If Alignment = [2] then[/code]
line. :frown:
[editline]10:26AM[/editline]
Changed it to
[code]If Alignment:= ('Dark Side') then[/code]
and I'm getting
How would I even incorporate boolean into the program? There must be a way to validate it without switching data types.[/QUOTE]
As far as i can remember := is for setting variables, NOT comparing...
Further more im having troubles seeing what you actually are trying to do with that IF statement.. Doesnt seem like correct syntax to me (Comparing an array to [2].. what is the idea?)
Nevermind.
Sorry, you need to Log In to post a reply to this thread.