Hello everyone, I'm trying to make a keyboard based password input system, rather than typing the password I have it set to scroll through letters for each slot. So far no errors but when I check the debug notes in game it states that all my key presses apart from my action/enter key are blocked and I'm stumped why
I appreciate any/all help :)
EDIT: My bad guys, just found the problem, was running another blocking script with the dialogue system, sorry for the fuss.
Here's the whole passoword script:
Spoiler
// Password Script
int PassCursor = 0;
import int KeyUp[2];
import int KeyDown[2];
import int KeyLeft[2];
import int KeyRight[2];
import int KeyAction[2];
import int KeyBack;
import int KeyMenu;
import int KeySprint[2];
import int KeyInventory;
Label* TB(int index)
{
if(index == 0){return lPassBox0;}
if(index == 1){return lPassBox1;}
if(index == 2){return lPassBox2;}
if(index == 3){return lPassBox3;}
if(index == 4){return lPassBox4;}
if(index == 5){return lPassBox5;}
}
function InitPasswordBox()
{
for(int i=0;i<6;i++)
{
TextBox* tb = TB(i);
Label* tb = TB(i);
tb.Text = " ";
}
}
function StartPasswordBox()
{
//InitPasswordBox();
lbActionBar.Visible = false;
PassCursor = 0;
gPassword.Visible=true;
PauseGame();
}
function PasswordBoxUp()
{
Label* tb = TB(PassCursor);
int c = tb.Text.Chars[0];
if(c == ' ') c = 'A';
else c = c + 1;
if(c > 'Z')
c = ' ';
tb.Text = tb.Text.ReplaceCharAt(0, c);
//aClick2.Play();
}
function PasswordBoxDown()
{
Label* tb = TB(PassCursor);
int c = tb.Text.Chars[0];
if(c == ' ') c = 'Z';
else c = c - 1;
if(c < 'A')
c = ' ';
tb.Text = tb.Text.ReplaceCharAt(0, c);
//aClick2.Play();
}
function PasswordBoxLeft()
{
int PassCursorWas = PassCursor;
PassCursor = PassCursor-1;
if(PassCursor<0) PassCursor=0;
//if(PassCursor != PassCursorWas)
//aClick2.Play();
}
function PasswordBoxRight()
{
int PassCursorWas = PassCursor;
PassCursor = PassCursor+1;
if(PassCursor>5) PassCursor=5;
//if(PassCursor != PassCursorWas)
//aClick2.Play();
}
function on_key_press(eKeyCode keycode)
{
if(gPassword.Visible)
{
switch(keycode)
{
case KeyAction[0]:
case KeyAction[1]:
if (lPassBox0.Text == PassLetter1 && lPassBox1.Text == PassLetter2 && lPassBox2.Text == PassLetter3 &&
lPassBox3.Text == PassLetter4 && lPassBox4.Text == PassLetter5 && lPassBox5.Text == PassLetter6)
{
gPassword.Visible=false;
UnPauseGame();
}
else
{
gPassword.Visible = false;
UnPauseGame();
// player.Speak("Didn't work.");
// CloseTextBox();
}
break;
//handle input on box
case KeyUp[0]:
case KeyUp[1]:
PasswordBoxUp();
break;
case KeyDown[0]:
case KeyDown[1]:
PasswordBoxDown();
break;
case KeyLeft[0]:
case KeyLeft[1]:
PasswordBoxLeft();
break;
case KeyRight[0]:
case KeyRight[1]:
PasswordBoxRight();
break;
}
}
}
function repeatedly_execute_always()
{
//make cursor track current cursor selection
if(gPassword.Visible)
{
Label* tb = TB(PassCursor);
bTextboxCursor.SetPosition(tb.X, tb.Y+16);
}
}