Page 1 of 1

If Text input == Text input do somting

PostPosted: Mon Jul 23, 2007 5:56 pm
by Rux
How do you make a SIMPLE Login screen, in other words, create actor on an ok button,
Code: Select all
UserCheck = 0;
PassCheck = 0;

ok,mousebutton down,
Code: Select all
if(UserCheck == 0, PassCheck == 0)
{
    PlaySound2("data/Denied.wav", 1.000000, 1, 1.000000);
}

and
Code: Select all
if(UserCheck == 1, PassCheck == 1)
{
    PlaySound2("data/Approved.wav", 1.000000, 1, 0.000000);
    MoveTo("view", 320.000000, -239.000000, 1000.000000, "Game Center", "");
}

And on the user name type in, draw actor,
Code: Select all
if(UserName.text == CurrentUser.text)
{
    UserCheck = 1;
}

Pass type in, draw actor
Code: Select all
if(Password.text == CurrentPassword.text)
{
    PassCheck = 1;
}

After all this it still doesn't work, what am I doing wrong?

P.S, is there anyway to prevent taskpanel, meta, alt+tab, and menu,I'm trying to make a secerity program.

Re: If Text input == Text input do somting

PostPosted: Mon Jul 23, 2007 8:00 pm
by metal_pt
Try it like this:

Code: Select all
UserCheck = 0;
PassCheck = 0;

ok,mousebutton down,
Code: Select all
if(UserCheck == 0 && PassCheck == 0)
{
    PlaySound2("data/Denied.wav", 1.000000, 1, 1.000000);
}

and
Code: Select all
if(UserCheck == 1 && PassCheck == 1)
{
    PlaySound2("data/Approved.wav", 1.000000, 1, 0.000000);
    MoveTo("view", 320.000000, -239.000000, 1000.000000, "Game Center", "");
}

And on the user name type in, draw actor,
Code: Select all
if(strcmp(UserName.text,CurrentUser.text)==1)
{
    UserCheck = 1;
}

Pass type in, draw actor
Code: Select all
if(strcmp(Password.text,CurrentPassword.text)==1)
{
    PassCheck = 1;
}

PostPosted: Mon Jul 23, 2007 8:16 pm
by metal_pt
hmmmm
Instead of
strcmp(UserName.text,CurrentUser.text)==1
use
strcmp(UserName.text,CurrentUser.text)==0

PostPosted: Mon Jul 23, 2007 8:34 pm
by Rux
It works, but I have another question, How do you make it so when the user or password, is tiped correctly changes their value from 0 to 1, and then the person typing in the username or password, accedently hits another button, so the value changes from 1 to 0? It doesn't do that.
And how to save a string, then load it.

PostPosted: Tue Jul 24, 2007 7:50 am
by metal_pt
Instead of checking it in a draw actor event, check it in the mouse button down event.

Hope it helps.

PostPosted: Tue Jul 24, 2007 5:20 pm
by Sgt. Sparky
for writing string:
Code: Select all
FILE*file;
file = fopen("yourfilename", "w+");
fwrite(&yourstring, sizeof(yourstring), 1, file);
fclose(file);

for loading string:
Code: Select all
FILE*file;
file = fopen("yourfilename", "r+");
fread(&yourstring, sizeof(yourstring), 1, file);
fclose(file);

:D

Re: If Text input == Text input do somting

PostPosted: Wed Jul 25, 2007 7:07 pm
by Rux
Rux wrote:P.S, is there anyway to prevent taskpanel, meta, alt+tab, and menu,I'm trying to make a secerity program.

PostPosted: Thu Jul 26, 2007 4:22 pm
by Sgt. Sparky
what kind of a security program?

PostPosted: Thu Jul 26, 2007 9:34 pm
by Rux
A locking secirity program, how do you prevent the buttons, taskpanel, meta, alt+tab, and menu so whoever tries to break through can't get through.