Help with following code


#1

I’m hoping anyone here could help me with this code.

String[] gameIntro;
void setup() {
size(800, 600);
String[] save = loadStrings(“save1.txt”);
println(save);
gameIntro = save[0];
}
void draw() {
if (gameIntro == 0) { // I need it to be able to read this
}
}

KittyCatGamer123. :wink:


#2

Which part of this is giving you trouble?

Please read this guide:


#3

Please format your code with the </> sign.
You can edit your post by clicking the little pen on the bottom right corner of your post.

Concerning your problem, on this line: if (gameIntro == 0) you are trying to compare an integer value with a string variable. You can’t do that . You first need to convert your string into an integer.

Edit:
You can actually check out this subject on how to convert a string into an integer: Covert String to Integer


#4

Still no luck. Thanks for the </> sign though


#5

Please be more specific. Did you read the guide I posted above?