Page 1 of 1

Error:cant convert constchar glitch

PostPosted: Sun Mar 18, 2007 8:23 am
by kyensoftware
Error line 1: Incompatible types: cannot convert from const*char to ARY[256]char
CAN YOU PLEASE HELP ME I NEED THIS TO MAKE THE MAIN PART OF THE GAME: BATTLING!
Info about var:
String,save in gameVar, global
my code:
Code: Select all
robotfirstmove = "Binary Blast";

NEED HELP ASAP!
Im a good programmer with great exp in BASIC,OpenGL,C and HTML just i tink it tis a glitch.[/code]
EDIT: I fixed it, but this sucks, I have to use numbers, 0 = Binary Blast, 1 = Robo kick,etc. meh, im good at programming.
EDIT:Oh, hell here we go again! Now it wont change the text! help!
new code
Code: Select all
if (robotfirstmove = 1)
{
    text = "Binary Blast";
}













PostPosted: Sun Mar 18, 2007 9:09 am
by DilloDude
First of all, in the if statement, change the = to ==. To assign a string, use strcpy:
Code: Select all
strcpy(text, "Binary Blast");

tanks

PostPosted: Mon Mar 19, 2007 4:35 am
by kyensoftware
tanks a lot (actually robot alot!!)
EDIT: WTF! it says INARY LAST?????
EDIT: hehe, well there is no uppercase, so yeah it displays white!

PostPosted: Mon Mar 19, 2007 1:02 pm
by makslane
To compare strings, you need to use the strcmp function:

Code: Select all
if(strcmp(robotfirstmove, "binary blast") == 0) 

   //Your commands here
}