Hi Board,

I like to create a kind of ingame address book, showing the addresses the player collected in some rows and add a function to filter the entries later on.

That's the idea, but it seems I've done something terribly wrong, as there are massive problems occuring, including some crashes of the editor.

Maybe somebody's having a good idea or some code-snippets?

What I've coded yet:

First of all, I created a struct that will contain the names and addresses. Simplified, this struct looks like this:
struct { char name; char street; var number;} data;
DATA* addressbook;

Storing some information using addressbook.name, addressbook.street = etc.. was simple.

To display the information onto the screens, I defined some TEXT*-panels, one for the row of names, one for the row of streets etc.
So there are three strings now, called name_string, street_string, number_string.

Now I wanted to copy the information out of the struct into the strings, seperated by "\n" for the new lines, having a string for each row.

But that didn't work.
name_string = addressbook.name as a test will crash the editor.

My first idea, to use a while-loop doesn't work either.

while(i)
name_string = str_cat(name_string, addressbook.name);


I've got that feeling, that there has to be a much easier way...

So any help will be appreciated!! Thanks!

---------------------

Hallo,

ich möchte gerne ein Ingame Adressbuch erstellen, bei dem dem Spieler die bereits gefundenen Orte und Personen in Reihen aufgelistet werden. Später soll eventuell eine Filterfunktion dazukommen. Soweit die Idee, jedoch scheine ich da etwas falsch zu machen.

Ich hoffe dass mir jemand mit einer guten Idee oder ein paar Zeilen Code weiterhelfen kann.

Bisher habe ich folgendes gemacht:

Als erstes habe ich eine Struct erstellt, in der die Namen und Adressen gespeichert werden sollen. Vereinfacht ausgedrückt, sieht diese so aus:

struct looks like this:
struct { char name; char street; var number;} data;
DATA* addressbook;

Die Informationen mittels addressbook.name, addressbook.street = etc.. einzuspielen war kein Problem.

Um später die Adressen in Reihen ausgeben zu lassen, habe ich drei TEXT*-panels, pro Reihe eine, erstellt.
Die dazugehörigen Strings, name_string, street_string, number_string, habe ich auch definiert.

Jetzt wollte ich die Informationen aus der Struct in die Strings kopieren, jeweils mit einem Zeilenumbruch getrennt. Damit hätte ich dann pro Reihe einen String.

Aber das funktioniert bislang nicht.

name_string = addressbook.name als Testversion bringt den Editor zum Absturz.

Auch meine erste Idee, eine While-loop zu nutzen klappt nicht.

while(i)
name_string = str_cat(name_string, addressbook.name);

Ich habe das Gefühl, es muss auch einfacher gehen...
Für Hilfe bin ich dankbar!

Last edited by Zalon; 05/29/07 19:15.