Well, I took on the task of working on a game someone had given up on, and I began to find out why the person gave up on it. It's made using Deadrons Character Handling, and although it saves/loads characters just fine, there's nothing to stop players from making a character with the same name as somebody elses character. I need a way to fix that.
I tried myself to figure out how to make a code which would create a list, write new chars into it when they're made, and then read that file for existing chars when new ones are being created, but my effort was in vain. Yet it sounded so easy to me. Heh. Anyway, I thought about scrapping the game, but I've already done a decent amount of work, and would really like to see it go further. I'm still kinda new to the DM language, so please go easy on me. I sure hope someone can help though.
Oh, and if creating a list isn't the best way to go about it, could someone inform me of the proper way? A list just seemed like the best idea at the time.
Hmmm I dont see why some person couldn't have the same name as another. Happens enough times in the real world.
To it with list you would need to store it into a seprate savefile. Lets call it pcnames.sav. Now lets take it in sections. The first section to do is the adding the name to the savefile. So when someone creates a new character lets add there name. listofnames.Add(usr.name) should do the trick. Now we save are listofnames to are savefile.
Now for the second section loading the list. At the main login start just load the list to the listofnames.
Then at the create a character part. Just compair the name they entered with the names in the list.
Last but not least. When you delete a character you want that name out of the list. You will use the same code above except. You would add a listofnames.Remove(n). So the name in the list is removed. Then you would save the listofnames too the savefile again.
Hope all that info helps.