Autor Beitrag
NetZwerg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 04.04.04 15:49 
ich mache so'ne art käsekästchen. Dann gibt es einen integer in dem steht meinetwegen "32" und das weiß der computer welches feld er belegen sollte (feld 3.2).

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
begin
  if (Boolean(FindVariable('PCChecked' + IntToStr(Should)) = false) and (Boolean(FindVariable('Checked' + IntToStr(Should)) = false) then
  begin
    TImage(FindComponent('grid' + IntToStr(Should)) = false).Picture.LoadFromFile('circle.jpg');
    PCChecked11 := True;
  end;
end;


Jo, also: PCChecked überprüft ob das Feld vom Computer ausgewählt wurde, Checked ob es vom Spieler ausgewählt wurde. Should issn Integer mit dem Wert welches feld der Computer nehmen sollte. GridXX issn Feld, das dann halt markiert wird.

Tja, und jetzt bräuchte ich was für dieses FindVariable da oben!?

cYa, Dave

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 04.04.04 15:59 
Wie wärs mit nem Array..? :roll: ;)

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 04.04.04 16:10 
Kann man Arrays suchen? :roll: Nee, sicher könnte ich n array machen... das is sogar ganz gut! Ja, das machich! :D

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 04.04.04 16:26 
oh, das is jetz blöd...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
if Turn = 'Computer' then
begin
  if Checked[Should] = false then
  begin
    (FindComponent('Grid' + IntToStr(Should)) as TImage).Picture.LoadFromFile('circle.jpg');
    Checked[Should] := True;
    Turn := 'Player';
  end;
end;


ich habe n paar kästchen die grid11, grid 12, grid 13 usw. heißen. Checked is jetz n Array[1..33]. Und Turn is n einfacher string der Feststellt ob der Computer oder der Player dran is. Wenn ich das jetz allerdings aufrufe kommt 'ne fehlermeldung:

Zugriffsverletzung an adresse.... EAccesViolence...

:?:

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 04.04.04 21:40 
NetZwerg hat folgendes geschrieben:
Zugriffsverletzung an adresse.... EAccesViolence...

Das klingt ganz danach als ob er keine Komponente mit dem angegebenen Namen findet..! Schon mal gedebuggt und geschaut ob die Namenszusammenstellungen auch korrekt sind..? Ansonsten eventuell eine Abfrage einbauen ob FindComponent nil zurückgibt...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
NetZwerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: So 04.04.04 21:48 
hat sich geklärt... hatte Should keinen Wert zugewiesen :oops: Hab's so gemacht das Should erst n wert zugewiesen wird, wenn mindestens 2 kästchen markiert sind! :shock:

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur