String help please!

You must understand the Game Editor concepts, before post here.

String help please!

Postby Bee-Ant » Fri Jan 04, 2008 9:38 am

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...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: String help please!

Postby Fuzzy » Fri Jan 04, 2008 9:59 am

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
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: String help please!

Postby Bee-Ant » Fri Jan 04, 2008 10:05 am

Oops, little mistake :oops:
OK, I'll try...thanks Pete... :mrgreen:

Btw, what's strcmp means??? :roll:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: String help please!

Postby Bee-Ant » Fri Jan 04, 2008 10:11 am

String Compare...
OK...I got it :oops:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: String help please!

Postby Bee-Ant » Fri Jan 04, 2008 11:40 am

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:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: String help please!

Postby Troodon » Sat Jan 05, 2008 6:40 pm

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
}
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: String help please!

Postby Bee-Ant » Sun Jan 06, 2008 7:24 am

Oh...yes, it works...thanks mikey...who's really missed that
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: String help please!

Postby Troodon » Sun Jan 06, 2008 12:50 pm

Hey! I'm not Mikey! :x
:lol:
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: String help please!

Postby Kalladdolf » Sun Jan 06, 2008 4:43 pm

that topic's been great help, thanks =D
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest