Hey again, thanks for the reply. I am unsure what is truly wrong with my indentation, I tried to fix up some of the few errors where I found them. I have looked up some of it online to see and they don't really say much other than what I have. Anyways, no you don't sound like a jerk, and I would truly like to do it to a standard format for ease of use for you guys to be able to help so I don't need to hear this again haha.
Anyways, if you have gotten a syntax error, I am assuming you do not have Cloggy's D3D plugin. It's a text plugin which I found speeds up text a lot. So, I've been using that. Anyways, here is the complete code, sorry about length again, but I thought it would be best to get a full working code ( may cut out the parts not relevant though, ie: inventory and such ), just anything with d3d would have to be made into dbText(). If you would prefer I do that, I can work on that a bit more. I commented as much as I could to give you a full understanding of it.
I think there is a slight misunderstanding on how the name is put in. It is not done by keypress so much as using W,A,S,D to move a cursor, and K to select the letter, and L to go back, if that makes sense. I only did this because I plan to implement the use of PC controllers, as I did for another game I worked on a bit using DBP. Anyways.... here is what I have thus far, and again.... very very sorry for the length. It's an RPG, so it has a lot of stuff in there.
THANKS SO MUCH FOR ANY HELP YOU CAN GIVE, I still try to work on this EVERY day, but fail miserably at getting it past 7 letters without crashing. I have set the array and acceptance criteria higher to see, and yet again it goes back to the title screen.
/ Dark GDK - The Game Creators - www.thegamecreators.com
#include "DarkGDK.h"
//#include "XB360 Controller.h"
#include "Globals.h"
#include "D3DFunc.h"
//Array for Texts
char txt[100];
char ChtrName[6][10];
char ChrLetters[8][1];
//AN ARRAY FOR THE NAMES OF THE ITEMS IN THE INVENTORY AND POTENTIALLY IN THE INVENTORY
char InventoryNames[2000][2][40]; //[x][0] = Name, [x][1] = description
//GameModes
enum eMode { eGameSetup , eControlSetup, eGameTitle, eContinue, eLoadGame, eMainGame, eOptions, eExit, eLastPoint, eGameLoad, eDisplay, eNameCharacter };
eMode g_eGameMode = eGameSetup;
//VARIOUS INT'S FOR VARIABLE CHECKS AND TRIGGERS
int MenuOption = 0;
int MenuOpen = 0;
int MenuSelect = 0;
int Timer = 15;
int MaxMenu = 0;
int TextTimer = 0;
int nx = 0;
int NameLetter = 0;
int AcceptName = 0;
int Default = 1;
int factorx = 0;
int factory = 0;
int cursorx = 0;
int CharacterNumber = 0;
int cursory = 0;
int NameCharacter1 = 0;
int NameCharacter2 = 0;
int NameCharacter3 = 0;
int NameCharacter4 = 0;
int NameCharacter5 = 0;
int NameCharacter6 = 0;
int itx = 250;
int ity = 0;
int xx;
int Character;
int Quant;
int InventoryArray[2000][14];
int ChtrStats[6][40];
void DarkGDK ( void ) {
while ( LoopGDK ( ) ) {
Game( );
dbSync( );
}
return;
}
void Game( void ) {
switch ( g_eGameMode ) {
case eGameSetup:
GameSetup( ); break;
case eControlSetup:
ControlSetup( ); break;
case eGameTitle:
GameTitle( ); break;
case eContinue:
Continue( ); break;
case eNameCharacter:
NameCharacter( ); break;
case eExit:
Exit( ); break;
case eGameLoad:
GameLoad( ); break;
case eMainGame:
MainGame( ); break;
case eDisplay:
Display( ); break;
}
}
void GameSetup ( void ){
//SETUP FOR DISPLAY AND FONTS//
dbHideMouse( );
dbSetDisplayMode ( 1024 , 768 , 32 );
dbSyncOn( );
dbSyncRate( 0 );
dbMaximiseWindow( );
dbBackdropOn( );
dbColorBackdrop( dbRgb(0, 0, 0) );
//XB360Init( );
//INITIATES CLOGGY'S D3D TEXT PLUGIN
d3dInit( );
d3dFont( 1,"Sable",48,0,0,0);
d3dFont( 2,"Sable",24,0,0,0);
d3dFont( 3,"Sable",36,0,0,0);
d3dFont( 4,"Sable",42,0,0,0);
//FOR SAVE FILES WHEN I GET THE SAVE FUNCTION WORKING
if ( dbFileExist( "Data/Saves/Save.dat" ) ) {
MenuOption = 0;
MaxMenu = 0;
}
else {
MenuOption = 1;
MaxMenu = 1;
}
g_eGameMode = eControlSetup;
}
void ControlSetup ( void ) {
g_eGameMode = eGameTitle;
}
void GameTitle ( void ) {
d3dStartText( );
d3dText( 1,610,55,0,"Lunar Eclipse",dbRGB( 150,0,0 ) );
sprintf_s( txt,150,"FPS:%d",dbScreenFPS ( ) );
d3dText( 2,10,100,0,txt );
if ( MaxMenu == 1 )
d3dText( 2,650,150,0,"Continue",dbRGB( 130,100,100 ) );
else
d3dText( 2,650,150,0,"Continue",dbRGB( 150,50,0 ) );
d3dText( 2,700,200,0,"New Game",dbRGB( 150,50,0 ) );
d3dText( 2,750,250,0,"Options",dbRGB( 150,50,0 ) );
d3dText( 2,800,300,0,"Exit",dbRGB( 150,50,0 ) );
sprintf_s( txt,150,"MenuOption:%d",MenuOption );
d3dText( 2,10,200,0,txt );
if ( MenuOption == 0 )
d3dText( 2,650,150,0,"Continue",dbRGB( 250,100,0 ) );
if ( MenuOption == 1 )
d3dText( 2,700,200,0,"New Game",dbRGB( 250,100,0 ) );
if ( MenuOption == 2 )
d3dText( 2,750,250,0,"Options",dbRGB( 250,100,0 ) );
if ( MenuOption == 3 )
d3dText( 2,800,300,0,"Exit",dbRGB( 250,100,0 ) );
d3dEndText( );
MenuOption--;
Timer = 15;
}
if ( dbDownKey( ) && Timer == 0 ) {
MenuOption++;
Timer = 15;
}
if ( dbReturnKey( ) == 1 && Timer == 0 ) {
Timer = 15;
if ( MenuOption == 0 )
g_eGameMode = eContinue;
if ( MenuOption == 1 )
g_eGameMode = eGameLoad;
if ( MenuOption == 2 )
g_eGameMode = eOptions;
if ( MenuOption == 3 )
g_eGameMode = eExit;
}
if ( MenuOption > 3 )
MenuOption = MaxMenu;
if ( MenuOption < MaxMenu )
MenuOption = 3;
Timer--;
if ( Timer < 0 )
Timer = 0;
}
void Continue ( void ){
}
void Options ( void ){
}
void Exit ( void ) {
//EXIT GAME
dbEnd( );
}
void GameLoad ( void ) {
//MAKES PLACEHOLDER CUBES FOR THE MAIN CHARACTER AND ENEMIES, THOUGH THE ENEMIES SEEM TO BE OVERWRITTEN//
for ( int ih = 1; ih < 4; ih++ ) {
dbMakeObjectBox( ih,dbRnd( 500 ),dbRnd( 500 ),dbRnd( 500 ) );
dbColorObject ( ih, dbRgb( dbRnd( 255 ),dbRnd( 255 ),dbRnd( 255 ) ) );
dbSetObjectSpecularPower ( ih, 255 );
dbSetObjectAmbient ( ih, 0 );
dbPositionObject ( ih,0 + dbRnd( 1000 ), 0 ,dbRnd( 1000 ) + dbRnd( 1000 ) );
}
dbMakeObjectBox( 5, 100, 100 , 100 );
dbPositionObject( 5, 0, 0, 0 );
dbColorObject ( 5, dbRGB( 250, 250, 0 ) );
dbPositionCamera( dbObjectPositionX( 5 )+1000, dbObjectPositionY( 5 )+800, dbObjectPositionZ( 5 ));
dbPointCamera( dbObjectPositionX( 5 ), dbObjectPositionY( 5 ), dbObjectPositionZ( 5 ));
g_eGameMode = eMainGame;
}
void MainGame ( void ) {
//THIS IS THE MAIN GAME AREA, WHERE IT ALLOWS CHARACTER MOVEMENT//
//DISPLAYS VALUES ASSOCIATED TO DIFFERENT ASPECTS OF THE GAME AS//
//A CHECK TO ENSURE THAT THE VALUES CHANGE ACORDINGLY//
d3dStartText( );
sprintf_s( txt,50,"FPS:%d",dbScreenFPS ( ) );
d3dText( 2,10,50,0,txt );
sprintf_s( txt,100,"X:%d",dbObjectPositionX( 5 ) );
d3dText( 2,10,100,0,txt );
sprintf_s( txt,150,"Y:%d",dbObjectPositionY( 5 ) );
d3dText( 2,10,150,0,txt );
sprintf_s( txt,200,"Z:%d",dbObjectPositionZ( 5 ) );
d3dText( 2,10,200,0,txt );
sprintf_s( txt,250,"MenuOpen:%d",MenuOpen );
d3dText( 2,10,250,0,txt );
sprintf_s( txt,300,"MenuOption:%d",MenuOption );
d3dText( 2,10,300,0,txt );
sprintf_s( txt,350,"MenuSelect:%d",MenuSelect );
d3dText( 2,10,350,0,txt );
sprintf_s( txt,400,"NameCharacter1:%d",NameCharacter1 );
d3dText( 2,10,400,0,txt );
sprintf_s( txt,400,"MOVEMENT: W,S,A,D. J = NAME CHARACTER, I = MENU, K = OK, L = CANCEL",CharacterNumber );
d3dText( 2,10,450,0,txt );
//CHARACTER NAME DISPLAY
d3dText( 4, 100, 550, 0, ChtrName[0], dbRGB( 150, 50, 0 ) );
d3dText( 4, 100, 600, 0, ChtrName[1], dbRGB( 150, 50, 0 ) );
d3dEndText( );
//THIS TRIGGERS THE NAMING SCREEN BY PRESSING "J"
if ( dbKeyState( 36 ) == 1 && CharacterNumber == 0 )
//ENSURE THAT IT IS SET TO CHARACTER1//
NameCharacter1 = 1;
//THIS SETS THE MENU PAGE TO THE INITIAL PAGE
if ( dbKeyState( 23 ) && MenuOpen == 0 ) {
MenuOption = 0;
MenuOpen = 1;
}
//THIS OPENS THE MENU SCREEN WHEN "I" IS PRESSED.
if ( MenuOpen > 0 )
Menu( );
//THIS DETERMINES WHICH CHARACTER NUMBER/NAME TO CREATE. CURRENTLY SET TO ONLY A SINGLE CHARACTER//
if ( NameCharacter1 == 1 && AcceptName == 0 && CharacterNumber == 0 )
NameCharacter( );
if ( NameCharacter2 == 1 && AcceptName == 0 && CharacterNumber == 1 )
NameCharacter( );
if ( NameCharacter3 == 1 && AcceptName == 0 && CharacterNumber == 2 )
NameCharacter( );
if ( NameCharacter4 == 1 && AcceptName == 0 && CharacterNumber == 3 )
NameCharacter( );
if ( NameCharacter5 == 1 && AcceptName == 0 && CharacterNumber == 4 )
NameCharacter( );
if ( NameCharacter6 == 1 && AcceptName == 0 && CharacterNumber == 5 )
NameCharacter( );
//THIS "LOCK" PLAYER CONTROLS AND THE HUD WHEN THE PLAYER IS ACCESSING THE INVENTORY/MENU//
if ( MenuOpen == 0 && NameCharacter1 == 0 && NameCharacter2 == 0 ) {
GameControls( );
Display( );
}
}
void GameControls ( void ) {
//MOVEMENTS
//Move Forward
if ( dbKeyState( 17 ) )
dbMoveObject( 5,5 );
//Move Backwards
if ( dbKeyState( 31 ) )
dbMoveObject( 5,-5 );
//Turn/StrafeLeft
if ( dbKeyState( 30 ) )
dbYRotateObject( 5,dbObjectAngleY( 5 ) -5 );
//Turn/StrafeRight
if ( dbKeyState( 32 ) )
dbYRotateObject( 5,dbObjectAngleY( 5 ) + 5 );
}
void Display ( void ){
}
void NameCharacter( ) {
//FACTOR Y
//FACTOR Y CONTROLS THE Y POSITIONING OF THE IMAGE ENCASING THE LETTER TO INDICATE WHERE IT SHOULD BE POSITIONED
if ( NameLetter < 13 )
factory = 0;
if ( NameLetter < 26 && NameLetter > 12 )
factory = 1;
if ( NameLetter < 39 && NameLetter > 25 )
factory = 2;
if ( NameLetter < 52 && NameLetter > 38 )
factory = 3;
//FACTOR X
//FACTOR X CONTROLS THE X POSITIONING OF THE IMAGE ENCASING THE LETTER TO INDICATE WHERE IT SHOULD BE POSITIONED
if ( NameLetter < 13 )
factorx = NameLetter;
if ( NameLetter > 12 && NameLetter < 26 )
factorx = NameLetter - 13;
if ( NameLetter > 25 && NameLetter < 39 )
factorx = NameLetter - 26;
if ( NameLetter > 38 && NameLetter < 52 )
factorx = NameLetter - 39;
//THE CALCULATION INVOLVING FACTOR X AND FACTOR Y TO DETERMINE WHERE THE IMAGE SHOULD BE PLACED
cursorx = ( ( 50 * factorx ) + 90 );
cursory = ( ( factory * 50 ) + 205 );
d3dStartText( );
if ( NameLetter > 54 )
d3dText( 4, 790, 505 + ( ( NameLetter - 55 ) * 50 ), 0, "[ ]", dbRGB( 50, 150, 100 ) );
else
d3dText( 4, cursorx, cursory, 0, "[ ]", dbRGB( 50, 150, 100 ) );
d3dEndText( );
//THE MAIN NAMING SECTION
//THIS STATEMENT ENSURES THAT THE LETTERS ARE 'ONLY' SELECTABLE SO LONG AS THE NAME HAS 'NOT' BEEN ACCEPTED
//AND AS LONG AS THE NAME LENGTH IS 'UNDER' 9
if ( AcceptName < 2 && nx < 9 ) {
//THIS COPIES THE LETTER SELECTED INTO AN ARRAY TO GET STORED INTO A SINGLE CHARACTER ARRAY FOR EACH CHARACTER
//WHICH WILL BE CREATED. THE LETTERS ARE NOT TYPED BUT SELECTED BY MOVEMENT OF A CURSOR USING W,A,S,D AND K TO SELECT
if ( NameLetter == 0 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "A" );
//nx IS INCREASED AFTER EACH LETTER TO COPY THE NEXT LETTER INTO THE ARRAY
nx++;
//TIMER IS USED TO MODERATE THE LENGTH BEFORE IT WILL ALLOW YOU TO SELECT ANOTHER LETTER
Timer = 15;
}
if ( NameLetter == 1 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "B" );
nx++;
Timer = 15;
}
if ( NameLetter == 2 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "C" );
nx++;
Timer = 15;
}
if ( NameLetter == 3 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "D" );
nx++;
Timer = 15;
}
if ( NameLetter == 4 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "E" );
nx++;
Timer = 15;
}
if ( NameLetter == 5 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "F" );
nx++;
Timer = 15;
}
if ( NameLetter == 6 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "G" );
nx++;
Timer = 15;
}
if ( NameLetter == 7 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "H" );
nx++;
Timer = 15;
}
if ( NameLetter == 8 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "I" );
nx++;
Timer = 15;
}
if ( NameLetter == 9 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "J" );
nx++;
Timer = 15;
}
if ( NameLetter == 10 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "K" );
nx++;
Timer = 15;
}
if ( NameLetter == 11 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "L" );
nx++;
Timer = 15;
}
if ( NameLetter == 12 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "M" );
nx++;
Timer = 15;
}
if ( NameLetter == 13 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "N" );
nx++;
Timer = 15;
}
if ( NameLetter == 14 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "O" );
nx++;
Timer = 15;
}
if ( NameLetter == 15 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "P" );
nx++;
Timer = 15;
}
if ( NameLetter == 16 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "Q" );
nx++;
Timer = 15;
}
if ( NameLetter == 17 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "R" );
nx++;
Timer = 15;
}
if ( NameLetter == 18 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "S" );
nx++;
Timer = 15;
}
if ( NameLetter == 19 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "T" );
nx++;
Timer = 15;
}
if ( NameLetter == 20 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "U" );
nx++;
Timer = 15;
}
if ( NameLetter == 21 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "V" );
nx++;
Timer = 15;
}
if ( NameLetter == 22 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "W" );
nx++;
Timer = 15;
}
if ( NameLetter == 23 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "X" );
nx++;
Timer = 15;
}
if ( NameLetter == 24 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "Y" );
nx++;
Timer = 15;
}
if ( NameLetter == 25 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "Z" );
nx++;
Timer = 15;
}
if ( NameLetter == 26 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "a" );
nx++;
Timer = 15;
}
if ( NameLetter == 27 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "b" );
nx++;
Timer = 15;
}
if ( NameLetter == 28 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "c" );
nx++;
Timer = 15;
}
if ( NameLetter == 29 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "d" );
nx++;
Timer = 15;
}
if ( NameLetter == 30 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "e" );
nx++;
Timer = 15;
}
if ( NameLetter == 31 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "f" );
nx++;
Timer = 15;
}
if ( NameLetter == 32 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "g" );
nx++;
Timer = 15;
}
if ( NameLetter == 33 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "h" );
nx++;
Timer = 15;
}
if ( NameLetter == 34 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "i" );
nx++;
Timer = 15;
}
if ( NameLetter == 35 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "j" );
nx++;
Timer = 15;
}
if ( NameLetter == 36 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "k" );
nx++;
Timer = 15;
}
if ( NameLetter == 37 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "l" );
nx++;
Timer = 15;
}
if ( NameLetter == 38 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "m" );
nx++;
Timer = 15;
}
if ( NameLetter == 39 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "n" );
nx++;
Timer = 15;
}
if ( NameLetter == 40 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "o" );
nx++;
Timer = 15;
}
if ( NameLetter == 41 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "p" );
nx++;
Timer = 15;
}
if ( NameLetter == 42 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "q" );
nx++;
Timer = 15;
}
if ( NameLetter == 43 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "r" );
nx++;
Timer = 15;
}
if ( NameLetter == 44 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "s" );
nx++;
Timer = 15;
}
if ( NameLetter == 45 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "t" );
nx++;
Timer = 15;
}
if ( NameLetter == 46 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "u" );
nx++;
Timer = 15;
}
if ( NameLetter == 47 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "v" );
nx++;
Timer = 15;
}
if ( NameLetter == 48 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "w" );
nx++;
Timer = 15;
}
if ( NameLetter == 49 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "x" );
nx++;
Timer = 15;
}
if ( NameLetter == 50 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "y" );
nx++;
Timer = 15;
}
if ( NameLetter == 51 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], "z" );
nx++;
Timer = 15;
}
//THIS WILL BE TO MOVE THE CURSOR TO THE ACCEPT BUTTON ONCE THE ARRAY IS FILLED
//if ( nx == 8 ) {
//NameLetter = 55;
//nx++;
//}
}
//THIS IS THE DELETE BUTTON, WHICH WILL REMOVE THE LAST LETTER SAVED INTO THE ARRAY
if ( NameLetter == 55 && dbKeyState( 37 ) == 1 && Timer == 0 || dbKeyState( 38 ) && Timer == 0 ) {
nx--;
strcpy( ChrLetters[nx],"" );
Timer = 15;
}
//THIS ACCEPTS THE CURRENT NAME SELECTED/CREATED
if ( NameLetter == 56 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
Default = 1;
NameCharacter1 = 0;
AcceptName++;
Timer = 15;
}
//THIS WILL ADD A SPACE INTO THE NAME
if ( NameLetter == 57 && dbKeyState( 37 ) == 1 && Timer == 0 ) {
strcpy( ChrLetters[nx], " " );
nx++;
Timer = 15;
}
//THIS RESTORES THE ARRAY/CHARACTER NAME TO THE DEFAULT NAME FOR CHARACTER 1
if ( NameLetter == 58 && dbKeyState( 37 ) == 1 && Timer == 0 && CharacterNumber == 0 ) {
strcpy( ChrLetters[0], "V" );
strcpy( ChrLetters[1], "i" );
strcpy( ChrLetters[2], "c" );
strcpy( ChrLetters[3], "t" );
strcpy( ChrLetters[4], "o" );
strcpy( ChrLetters[5], "r" );
nx = 6;
Timer = 15;
}
//THIS WILL RESTORE THE DEFAULT NAME FOR CHARACTER 2
if ( NameLetter == 58 && dbKeyState( 37 ) == 1 && Timer == 0 && CharacterNumber == 1 ) {
strcpy( ChrLetters[0], "X" );
strcpy( ChrLetters[1], "X" );
strcpy( ChrLetters[2], "X" );
strcpy( ChrLetters[3], "X" );
strcpy( ChrLetters[4], "X" );
nx = 5;
Timer = 15;
}
//THIS COPIES THE LETTER SELECTED FROM THE LETTER ARRAY INTO THE CHARACTER ARRAY FOR WHICH CHARACTER NUMBER IS SELECTED
strcpy( ChtrName[CharacterNumber], ChrLetters[0] );
d3dStartText( );
//DISPLAYS VARIABLES TO CHECK IF EVERYTHING IS CORRECT
d3dText( 4, 100, 50, 0, ChtrName[CharacterNumber], dbRGB( 150, 50, 0 ) );
d3dText( 4, 100, 650, 0, ChtrName[0], dbRGB( 150, 50, 0 ) );
d3dText( 4, 100, 700, 0, ChtrName[1], dbRGB( 150, 50, 0 ) );
sprintf_s( txt,500,"nx:%d",nx ); //don't know if this will work
d3dText( 2,10,500,0,txt );
sprintf_s( txt,150,"Name Letter:%d",NameLetter ); //don't know if this will work
d3dText( 2,10,125,0,txt );
sprintf_s( txt,150,"Timer:%d",Timer ); //don't know if this will work
d3dText( 2,10,150,0,txt );
sprintf_s( txt,550,"Accept Name:%d",AcceptName ); //don't know if this will work
d3dText( 2,10,550,0,txt );
//UPPER CASE LETTER DISPLAY
d3dText( 4, 100, 200, 0, "A", dbRGB( 150, 50, 0 ) );
d3dText( 4, 150, 200, 0, "B", dbRGB( 150, 50, 0 ) );
d3dText( 4, 200, 200, 0, "C", dbRGB( 150, 50, 0 ) );
d3dText( 4, 250, 200, 0, "D", dbRGB( 150, 50, 0 ) );
d3dText( 4, 300, 200, 0, "E", dbRGB( 150, 50, 0 ) );
d3dText( 4, 350, 200, 0, "F", dbRGB( 150, 50, 0 ) );
d3dText( 4, 400, 200, 0, "G", dbRGB( 150, 50, 0 ) );
d3dText( 4, 450, 200, 0, "H", dbRGB( 150, 50, 0 ) );
d3dText( 4, 500, 200, 0, "I", dbRGB( 150, 50, 0 ) );
d3dText( 4, 550, 200, 0, "J", dbRGB( 150, 50, 0 ) );
d3dText( 4, 600, 200, 0, "K", dbRGB( 150, 50, 0 ) );
d3dText( 4, 650, 200, 0, "L", dbRGB( 150, 50, 0 ) );
d3dText( 4, 700, 200, 0, "M", dbRGB( 150, 50, 0 ) );
d3dText( 4, 100, 250, 0, "N", dbRGB( 150, 50, 0 ) );
d3dText( 4, 150, 250, 0, "O", dbRGB( 150, 50, 0 ) );
d3dText( 4, 200, 250, 0, "P", dbRGB( 150, 50, 0 ) );
d3dText( 4, 250, 250, 0, "Q", dbRGB( 150, 50, 0 ) );
d3dText( 4, 300, 250, 0, "R", dbRGB( 150, 50, 0 ) );
d3dText( 4, 350, 250, 0, "S", dbRGB( 150, 50, 0 ) );
d3dText( 4, 400, 250, 0, "T", dbRGB( 150, 50, 0 ) );
d3dText( 4, 450, 250, 0, "U", dbRGB( 150, 50, 0 ) );
d3dText( 4, 500, 250, 0, "V", dbRGB( 150, 50, 0 ) );
d3dText( 4, 550, 250, 0, "W", dbRGB( 150, 50, 0 ) );
d3dText( 4, 600, 250, 0, "X", dbRGB( 150, 50, 0 ) );
d3dText( 4, 650, 250, 0, "Y", dbRGB( 150, 50, 0 ) );
d3dText( 4, 700, 250, 0, "Z", dbRGB( 150, 50, 0 ) );
//LOWER CASE
d3dText( 4, 100, 300, 0, "a", dbRGB( 150, 50, 0 ) );
d3dText( 4, 150, 300, 0, "b", dbRGB( 150, 50, 0 ) );
d3dText( 4, 200, 300, 0, "c", dbRGB( 150, 50, 0 ) );
d3dText( 4, 250, 300, 0, "d", dbRGB( 150, 50, 0 ) );
d3dText( 4, 300, 300, 0, "e", dbRGB( 150, 50, 0 ) );
d3dText( 4, 350, 300, 0, "f", dbRGB( 150, 50, 0 ) );
d3dText( 4, 400, 300, 0, "g", dbRGB( 150, 50, 0 ) );
d3dText( 4, 450, 300, 0, "h", dbRGB( 150, 50, 0 ) );
d3dText( 4, 500, 300, 0, "i", dbRGB( 150, 50, 0 ) );
d3dText( 4, 550, 300, 0, "j", dbRGB( 150, 50, 0 ) );
d3dText( 4, 600, 300, 0, "k", dbRGB( 150, 50, 0 ) );
d3dText( 4, 650, 300, 0, "l", dbRGB( 150, 50, 0 ) );
d3dText( 4, 700, 300, 0, "m", dbRGB( 150, 50, 0 ) );
d3dText( 4, 100, 350, 0, "n", dbRGB( 150, 50, 0 ) );
d3dText( 4, 150, 350, 0, "o", dbRGB( 150, 50, 0 ) );
d3dText( 4, 200, 350, 0, "p", dbRGB( 150, 50, 0 ) );
d3dText( 4, 250, 350, 0, "q", dbRGB( 150, 50, 0 ) );
d3dText( 4, 300, 350, 0, "r", dbRGB( 150, 50, 0 ) );
d3dText( 4, 350, 350, 0, "s", dbRGB( 150, 50, 0 ) );
d3dText( 4, 400, 350, 0, "t", dbRGB( 150, 50, 0 ) );
d3dText( 4, 450, 350, 0, "u", dbRGB( 150, 50, 0 ) );
d3dText( 4, 500, 350, 0, "v", dbRGB( 150, 50, 0 ) );
d3dText( 4, 550, 350, 0, "w", dbRGB( 150, 50, 0 ) );
d3dText( 4, 600, 350, 0, "x", dbRGB( 150, 50, 0 ) );
d3dText( 4, 650, 350, 0, "y", dbRGB( 150, 50, 0 ) );
d3dText( 4, 700, 350, 0, "z", dbRGB( 150, 50, 0 ) );
//SPECIAL LETTERS WHICH CAN BE USED
d3dText( 4, 100, 400, 0, "-", dbRGB( 150, 50, 0 ) );
d3dText( 4, 150, 400, 0, "'", dbRGB( 150, 50, 0 ) );
d3dText( 4, 200, 400, 0, "^", dbRGB( 150, 50, 0 ) );
//TEXT FOR ACCEPT/DELETE/SPACES/AND DEFAULT CHARACTER NAMES
d3dText( 4, 800, 500, 0, "Delete", dbRGB( 150, 50, 0 ) );
d3dText( 4, 800, 550, 0, "Accept", dbRGB( 150, 50, 0 ) );
d3dText( 4, 800, 600, 0, "Space", dbRGB( 150, 50, 0 ) );
d3dText( 4, 800, 650, 0, "Default", dbRGB( 150, 50, 0 ) );
d3dEndText( );
//THIS WILL MOVE THE CURSOR BACK FROM THE ACCEPT SECTION TO THE LETTER SELECT SECTION OF THE SCREEN
if ( dbKeyState( 30 ) && Timer == 0 ) {
if ( NameLetter == 55 || NameLetter == 56 || NameLetter == 57 || NameLetter == 58 )
NameLetter = 13;
NameLetter--;
Timer = 15;
}
//THIS WILL MOVE THE CURSOR OVER TO THE ACCEPT/DELETE/SPACE/DEFAULT NAME SECTION
if ( dbKeyState( 32 ) && Timer == 0 ) {
if ( NameLetter == 12 || NameLetter == 25 || NameLetter == 38 || NameLetter == 51 ) {
NameLetter = 55;
Timer = 15;
}
else {
NameLetter++;
Timer = 15;
}
}
if ( dbKeyState( 17 ) && Timer == 0 ) {
if ( NameLetter > 55 ) {
NameLetter--;
Timer = 15;
}
else {
if ( NameLetter == 55 ) {
NameLetter = 12;
Timer = 15;
}
else {
NameLetter = NameLetter - 13;
Timer = 15;
}
}
}
if ( dbKeyState( 31 ) && Timer == 0 ) {
if ( NameLetter > 54 ) {
NameLetter++;
Timer = 15;
}
else {
NameLetter = NameLetter + 13;
Timer = 15;
}
}
if ( NameLetter < 0 )
NameLetter = 0;
if ( NameLetter > 58 )
NameLetter = 58;
Timer--;
if ( Timer < 0 )
Timer = 0;
//IF THE nx VALUE FOR THE ARRAY IS ABOVE 9, IT STAYS AT 9
if ( nx < 0 )
nx = 0;
if ( nx > 9 )
nx = 9;
//IF DEFAULT BUTTON SELECTED REVERT NAME BACK TO DEFAULT FOR CHARACTER NAME 1
if ( AcceptName == 0 && CharacterNumber == 0 && Default == 1 ) {
CharacterNumber = 0;
strcpy( ChrLetters[0], "V" );
strcpy( ChrLetters[1], "i" );
strcpy( ChrLetters[2], "c" );
strcpy( ChrLetters[3], "t" );
strcpy( ChrLetters[4], "o" );
strcpy( ChrLetters[5], "r" );
nx = 6;
Default = 0;
}
//IF DEFAULT BUTTON SELECTED REVERT NAME BACK TO DEFAULT FOR CHARACTER NAME 2
if ( AcceptName == 1 && CharacterNumber == 1 && Default == 1 ) {
strcpy( ChrLetters[0], "X" );
strcpy( ChrLetters[1], "X" );
strcpy( ChrLetters[2], "X" );
strcpy( ChrLetters[3], "X" );
strcpy( ChrLetters[4], "X" );
nx = 5;
Default = 0;
}
}
void Menu( void ){
}
void Inventory( void ){
}
void Heal( void ){
}
void Drop ( void ){
}
void Equip ( void ){
}
void Totems ( void ){
}
void Magic ( void ){
}
void Party ( void ){
}
On the title screen press enter, then after that, 'j', and 'k' to enter the selected letter. 'w','a',s','d' to move cursor around. when nx = 8 it crashes.
Here is the globals header:
void Game ( void );
void GameSetup ( void );
void ControlSetup ( void );
void GameTitle( void );
void NewGame ( void );
void Continue ( void );
void LoadGame ( void );
void Options ( void );
void Exit ( void );
void MainGame ( void );
void GameLoad ( void );
void GameControls ( void );
void Display ( void );
void Menu ( void );
void NameCharacter ( void );
void Heal ( void );
void Inventory ( void );
void Drop ( void );
void Equip ( void );
void Totems ( void );
void Magic ( void );
void Party ( void );
//EXTERN INT'S FOR TRIGGERS
extern int MenuOption;
extern int ChtrStats[6][40];
extern int MenuOpen;
extern int MenuSelect;
extern int NameCharacter1;
extern int CharacterNumber;
extern int nx;
extern char ix;
extern int NameLetter;
extern int AcceptName;
extern int factorx;
extern int factory;
extern int cursorx;
extern int cursory;
extern int Timer;
extern int itx;
extern int ity;
extern int TitleAnim;
extern int AnimTimer;
extern int MaxMenu;
extern int TextTimer;
extern int CharacterNumber;
extern int Default;
//CHARACTER INFO
extern char ChtrName[6][10]; //CHARACTER NUMBER, CHARACTER NAME
//extern char ChrLetters[8][1];
extern int InventoryArray[2000][14];
extern char InventoryNames[2000][2][40];
extern int xx;
extern int Character;
extern int Quant;
//ITEM INFO
//extern int GameControls;
again, thanks for any help.