SO im to the point in my game I need to develop a dialog system for the main character to talk to other actors. I wanted to be able to store all of a actors available dialog in one variable, and easily loop through them with an integer counter.. so I picked a multi dimensional char array
![Smile :)](http://game-editor.com/forum/images/smilies/icon_smile.gif)
So I declare the car array in global code:
- Code: Select all
char SJdialogList[10][256];
Then in a create actor script where all of my other variables are initialized Im having problems initializing all of the array elements at once, like in this sample code I pulled from Bee-Ant's Dialog Engine demo:
- Code: Select all
char DialogList[20][256]= //20 is the max amount of dialog, 256 is the letters max amount
{
"Hello, my name is Bee-Ant",
"This is a dialog demo",
"It will generate random dialog to the screen",
"Check in the Global code -> Choose -> function\nto see the function to generate the scrolling\ntext effect",
"Check in the Global code -> Choose -> misc\nto see this dialog list",
"What's your name?",
"Oh...\nI have lived here for almost 999 years",
"Hello, my name is Idk",
"I'm busy right now...\nA lot of work to do...\nCome again later...",
"Coding is interesting...\nDo you feel the same thing?",
};
^^^
Thanks Bee-Ant!
Now I could just do each element individually:
- Code: Select all
strcpy(SJDialogList[0],
"Doctor, we all seem a bit paler\nthan usual. We should find a nice warm,\n\
sunny planet with nice beaches.");
strcpy(SJDialogList[1],
"Line 2");
...
But can you use strcpy to load up all of them at once, something like:
- Code: Select all
strcpy(SJDialogList,"Line 1", "Line 2", "Line 3");
The issue with the individual element solution is having to keep track of the element numbers if things get rearranged.
Thanks,
livens