Autor Beitrag
Chris Maslowski
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109



BeitragVerfasst: Do 24.02.05 12:30 
hallo leute,
aich hab mal eine frage. ich hab mir ein kleines spiel programmiert. doch ich weiß nicht wie ich den spelstand speichern soll. das speichern soll so weit gehen, das alle variablen gespeichert werden. es gibt ´z.B. ein variable für die erfahrungsüpunkte. und der benutzer soll nicht immer wieder bei 0 anfangen.
Grendel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 443

Gentoo Linux, MacOS X, Win 2000
D5 Ent, D7 Ent, Lazarus, Anjuta, MonoDevelop
BeitragVerfasst: Do 24.02.05 12:42 
Chris Maslowski hat folgendes geschrieben:
doch ich weiß nicht wie ich den spelstand speichern soll. das speichern soll so weit gehen, das alle variablen gespeichert werden.

Dann speicher die Variablen doch in einer Datei. Wenn es bloß um Schlüssel/Wert geht kannst Du z.B. TIniFile nutzen.

Bis neulich ...
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 24.02.05 12:48 
Oder Fasse alle Variablen, die gespeichert werden sollen in einem Record zusammen. Dann nimmst du eine typisierte Datei und speicherst darin.
Vorteil der INI-Datei:
Updates, zusätzliche Variablen musst du nur dazu packen.
Nachteil:
Es ist alles Klartext. Jeder Blödmann kann die Daten verändern. Es sein denn, Du verschlüsselst die Daten.

Vorteil typisierte Datei:
Numerische Werte sind schon für den Normal-Anwender nicht mehr erkennbar. Eine Veränderung der Strings kann auch nicht ohne weiteres gemacht werden.
Nachteil:
Zusätzliche Variablen musst du mit einer Update-Routine hinzufügen.
Chris Maslowski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109



BeitragVerfasst: Do 24.02.05 19:05 
kann mir jemand das mal genauer erklären. zb. das mit dem record. könnte man die variablen nicht in eine textdatei speichern und dan wieder asulesen?
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 24.02.05 19:56 
Klar kann man. Die Vor- und Nachteile habe ich doch schon erläutert.
Für typisierte Dateien und Records kannst du die Delphi-Online-Hilfe strapazieren oder hier mal die Suchfunktion benutzen.
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 27.02.05 23:41 
Wie erstelle ich eigentlich ein Record und wie speicher ich es.... Und wie funktioniert zur Not dieses Update?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 27.02.05 23:57 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
type
  myRec = Record;
    bla,blubb: integer;
    test:char;
  end;

...

var recordset: array of myRec;
    savefile: file of myRec;
...

begin
  setlength(recordset, anzahlrecors);
  assignfile(savefile, 'C:\test.sav');
  rewrite(savefile);
  for i := 0 to anzahlrecords - 1 do begin
    recordsetset[i].blubb := 1337;
    write(savefile,recordset[i]);
  end;
  closefile(savefile);
end;

wenn du infos zu einem hier verwendeten befehl brauchst markiere den befehl in delphi und drück F1
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 28.02.05 09:08 
[url=www.jasocul.de/Downl...urcen.zip]Hier[/url] findest du ein kleines Demo-Programm.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Mo 28.02.05 09:19 
Und wenn du lieber INI-Dateien nutzen möchtest gibts hier ein Tutorial dazu.

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: Mo 28.02.05 16:00 
Ja ini will ich nicht nehmen weil das dann jeder lesen kann
Chris Maslowski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109



BeitragVerfasst: Di 01.03.05 19:59 
Titel: dankeschön
danke für die hilfe leute
das hat echt gut geklappt mit dem IniFile. :wink:
:arrow: :lol: :) :D 8)