Einzelnen Beitrag anzeigen

fox67

Registriert seit: 6. Okt 2010
Ort: 72661 Grafenberg
181 Beiträge
 
Turbo Delphi für Win32
 
#1

Wer findet den Fehler?

  Alt 29. Aug 2012, 14:01
Da mir gerade ein bisschen langweilig ist programmiere ich ein Programm bei dem Autos zufallsgesteuert durch eine Strassenkarte mit mehreren Kreuzungen und Ampelsystemen. Doch das ganze hängt schon beiden Ampeln irgentein Fheler hat sich in den Code eingeschlichen und ich finde ihn nicht.
Code:
procedure TForm1.AmpelsteuerungTimer(Sender: TObject);


begin

if A = 0 then
begin
  ampelsteuerung.Interval:=6000;
  A:=A+1;
  rot1.Brush.Color := clred;
  gelb1.Brush.Color:= clblack;
  gruen1.Brush.Color:= clblack;
  rot2.Brush.Color := clblack;
  gelb2.Brush.Color:= clblack;
  gruen2.Brush.Color:= cllime;
  rot.Brush.Color:= clred;
  gelb.Brush.Color:= clblack;
  gruen.Brush.Color:= clblack;
  rot3.Brush.Color:= clblack;
  gelb3.Brush.Color:= clblack;
  gruen3.Brush.Color:= cllime;
  rot6.Brush.Color:= clred;
  gelb6.Brush.Color:= clblack;
  gruen6.Brush.Color:= clblack;
  rot5.Brush.Color:= clblack;
  gelb5.Brush.Color:= clblack;
  gruen5.Brush.Color:= cllime;
end;

if A = 1 then
begin
  ampelsteuerung.Interval:= 1000;
  A:=A+1;
  rot1.Brush.Color := clred;
  gelb1.Brush.Color:= clyellow;
  gruen1.Brush.Color:= clblack;
  rot2.Brush.Color := clblack;
  gelb2.Brush.Color:= clyellow;
  gruen2.Brush.Color:= clblack;
  rot.Brush.Color:= clred;
  gelb.Brush.Color:= clyellow;
  gruen.Brush.Color:= clblack;
  rot3.Brush.Color:= clblack;
  gelb3.Brush.Color:= clyellow;
  gruen3.Brush.Color:= clblack;
  rot6.Brush.Color:= clred;
  gelb6.Brush.Color:= clyellow;
  gruen6.Brush.Color:= clblack;
  rot5.Brush.Color:= clblack;
  gelb5.Brush.Color:= clyellow;
  gruen5.Brush.Color:= clblack;

end;
if A = 2 then
begin
  ampelsteuerung.Interval:=6000;
   A:=A+1;
  rot1.Brush.Color := clblack;
  gelb1.Brush.Color:= clblack;
  gruen1.Brush.Color:= cllime;
  rot2.Brush.Color := clred;
  gelb2.Brush.Color:= clblack;
  gruen2.Brush.Color:= clblack;
  rot.Brush.Color:= clblack;
  gelb.Brush.Color:= clblack;
  gruen.Brush.Color:= cllime;
  rot3.Brush.Color:= clred;
  gelb3.Brush.Color:= clblack;
  gruen3.Brush.Color:= clblack;
  rot6.Brush.Color:= clblack;
  gelb6.Brush.Color:= clblack;
  gruen6.Brush.Color:= cllime;
  rot5.Brush.Color:= clred;
  gelb5.Brush.Color:= clblack;
  gruen5.Brush.Color:= clblack;

end;
if A = 3 then
begin
  ampelsteuerung.Interval:=1000;
  A:=A-3;
  rot1.Brush.Color := clblack;
  gelb1.Brush.Color:= clyellow;
  gruen1.Brush.Color:= clblack;
  rot2.Brush.Color := clred;
  gelb2.Brush.Color:= clyellow;
  gruen2.Brush.Color:= clblack;
  rot.Brush.Color:= clblack;
  gelb.Brush.Color:= clyellow;
  gruen.Brush.Color:= clblack;
  rot3.Brush.Color:= clred;
  gelb3.Brush.Color:= clyellow;
  gruen3.Brush.Color:= clblack;
  rot6.Brush.Color:= clblack;
  gelb6.Brush.Color:= clyellow;
  gruen6.Brush.Color:= clblack;
  rot5.Brush.Color:= clred;
  gelb5.Brush.Color:= clyellow;
  gruen5.Brush.Color:= clblack;

end;
end;
DIe Ampel schält nicht sondern bleibt in der ersten situtation stehn
  Mit Zitat antworten Zitat