Page 1 of 1

String help please!

PostPosted: Fri Jan 04, 2008 9:38 am
by Bee-Ant
I have a string variable called password, I wanna use it as "LOG IN" stuff where you must enter your saved ID to load your saved game...but it doesnt work as my plan...
Code: Select all
if(EnterPassword.text==password)
{
    view.x+=480;
}

Then i change it to :
Code: Select all
if(EnterPassword.text=="Darkboy")
{
    view.x+=480;
}

Still doesnt work...

Re: String help please!

PostPosted: Fri Jan 04, 2008 9:59 am
by Fuzzy
if (strcmp( EnterPassword.text, password))
{
view.x+=480;
}

It stands for stringcompare.

check the GE documents for it as well as this.
http://www.thinkage.ca/english/gcos/exp ... trcmp.html

Re: String help please!

PostPosted: Fri Jan 04, 2008 10:05 am
by Bee-Ant
Oops, little mistake :oops:
OK, I'll try...thanks Pete... :mrgreen:

Btw, what's strcmp means??? :roll:

Re: String help please!

PostPosted: Fri Jan 04, 2008 10:11 am
by Bee-Ant
String Compare...
OK...I got it :oops:

Re: String help please!

PostPosted: Fri Jan 04, 2008 11:40 am
by Bee-Ant
i put
Code: Select all
loadVars("data.dat", "atr");
if (strcmp(pass.text, names))
{
    view.x+=480;
    strcpy(garagedialog.text,"NICE TO SEE YOU AGAIN");
    passord.textNumber=000000;
    lastpassword.textNumber=000000;
    PlaySound2("data/accepted.wav", 1.000000, 1, 0.000000);
}

And it accepts only names, instead of the names-value :roll: :roll: :roll:

Re: String help please!

PostPosted: Sat Jan 05, 2008 6:40 pm
by Troodon
I just found out that you need to change the code like this to check the variable value:
(at least it works)

if (strcmp(pass.text, names)==0)
{
blaa blaa
}

Re: String help please!

PostPosted: Sun Jan 06, 2008 7:24 am
by Bee-Ant
Oh...yes, it works...thanks mikey...who's really missed that

Re: String help please!

PostPosted: Sun Jan 06, 2008 12:50 pm
by Troodon
Hey! I'm not Mikey! :x
:lol:

Re: String help please!

PostPosted: Sun Jan 06, 2008 4:43 pm
by Kalladdolf
that topic's been great help, thanks =D