Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - alcitos517

#1
Good news..  I ran an updater on directX and it fixed it.. still v9.0c, but perhaps something was messed up with the installation before.  Thanks :) 
#2
directX 9.0c.  I'll try updating
#3
It seems like when it passes text to a textbox that it checks the key being pressed and passes it on each game loop.  If I am extremely careful about typing the letters, I can avoid repeating a lot, but some repeating is still unavoidable, and it requires a lot of care to get that far.  Using GarageGothic's 2nd suggestion (the first didnt work out), I came up with some code to use a label within a GUI as a custom textbox and control the flow that way, and it works pretty good (not perfect).  It seeks to delay repeat of keys by a couple of extra loops.  Of course, a native textbox that doesn't have this repeat issue would be better :)   But this method wouldn't be too bad for my current need since it's just to type in answers to specific questions in a specific room.  My code is below:

// room script file

int lastKeyPress; // the last key that was pressed prior to the current one
String keyPressed; // string value of the current key pressed.
int keyPresses = 0; // number of loops during which the key has been pressed.

function room_FirstLoad()
{
  // Set the GUI to visible for easy testing.
  gTesting.Visible = true;
}


function on_key_press(eKeyCode keycode)
{
  int pkp = 0;
  // continue only if the GUI is visible
  if (gTesting.Visible == true)
  {
    // Prevent global key press function from executing
  ClaimEvent();

    // Check each pertinent key to see if it is the pressed key.
    // If one of these keys is pressed: First set the string variable (keyPressed) to the appropriate character,
    // Then check if this key was also the last key that was pressed previously.  If it was not, set the KeyPresses
    // to 3, which will allow it to be appended right away and reset keyPresses to 1.  If it was the last key,
    // increment key presses by 1, until it reaches 3, at which point it will be appended, creating the delay. 
    if (keycode == eKeyA) {keyPressed = "A"; pkp = 1; if(lastKeyPress == eKeyA) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyB) {keyPressed = "B"; pkp = 1; if(lastKeyPress == eKeyB) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyC) {keyPressed = "C"; pkp = 1; if(lastKeyPress == eKeyC) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyD) {keyPressed = "D"; pkp = 1; if(lastKeyPress == eKeyD) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyE) {keyPressed = "E"; pkp = 1; if(lastKeyPress == eKeyE) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyF) {keyPressed = "F"; pkp = 1; if(lastKeyPress == eKeyF) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyG) {keyPressed = "G"; pkp = 1; if(lastKeyPress == eKeyG) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyH) {keyPressed = "H"; pkp = 1; if(lastKeyPress == eKeyH) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyI) {keyPressed = "I"; pkp = 1; if(lastKeyPress == eKeyI) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyJ) {keyPressed = "J"; pkp = 1; if(lastKeyPress == eKeyJ) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyK) {keyPressed = "K"; pkp = 1; if(lastKeyPress == eKeyK) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyL) {keyPressed = "L"; pkp = 1; if(lastKeyPress == eKeyL) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyM) {keyPressed = "M"; pkp = 1; if(lastKeyPress == eKeyM) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyN) {keyPressed = "N"; pkp = 1; if(lastKeyPress == eKeyN) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyO) {keyPressed = "O"; pkp = 1; if(lastKeyPress == eKeyO) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyP) {keyPressed = "P"; pkp = 1; if(lastKeyPress == eKeyP) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyQ) {keyPressed = "Q"; pkp = 1; if(lastKeyPress == eKeyQ) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyR) {keyPressed = "R"; pkp = 1; if(lastKeyPress == eKeyR) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyS) {keyPressed = "S"; pkp = 1; if(lastKeyPress == eKeyS) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyT) {keyPressed = "T"; pkp = 1; if(lastKeyPress == eKeyT) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyU) {keyPressed = "U"; pkp = 1; if(lastKeyPress == eKeyU) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyV) {keyPressed = "V"; pkp = 1; if(lastKeyPress == eKeyV) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyW) {keyPressed = "W"; pkp = 1; if(lastKeyPress == eKeyW) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyX) {keyPressed = "X"; pkp = 1; if(lastKeyPress == eKeyX) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyY) {keyPressed = "Y"; pkp = 1; if(lastKeyPress == eKeyY) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyZ) {keyPressed = "Z"; pkp = 1; if(lastKeyPress == eKeyZ) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeySpace) {keyPressed = " "; pkp = 1; if(lastKeyPress == eKeySpace) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
    if (keycode == eKeyBackspace) {keyPressed = "*"; pkp = 1; if(lastKeyPress == eKeyBackspace) {keyPresses = keyPresses + 1;} else {keyPresses = 3;}}
 
    // set the last key that was pressed
    lastKeyPress = keycode;
   
    // if a pertinent key isn't being pressed, exit function
    if (pkp != 1) {return;}
    // Can't append a backspace via a string variable
    if (keycode != eKeyBackspace) {
      // If the key has been pressed either for 3 loops, or this is the first loop during which the key was pressed
      // (see above), append the value of the key to the label text.
      if (keyPresses >= 3 && keycode != 0) { lblText.Text = lblText.Text.Append(keyPressed); keyPresses = 0;}
    }
    else {
      // Similarly controlling the rate of the backspace key.
    if (keyPresses >= 3 && lblText.Text.Length > 0) { lblText.Text = lblText.Text.Truncate(lblText.Text.Length - 1); keyPresses = 0; }
    }
     
  }
}
#4
Is there a way in scripting to control the flow of text into a textbox?  I know that when a GUI with a textbox is on that the text is not passed to the "on key press" function in the global script, so it doesn't seem like there's any way to prevent the keys from repeating so quickly.  Any ideas?
#5
It's just a standard GUI textbox.  The only code I used was to make the GUI visible.  However, the same thing happens in the built-in saved game GUI when typing, not only in my game, but also in the KQ3 remake and "A Tale of Two Kingdoms", and in the Demo game, which leads me to believe it couldn't be something I did.  It would have to be either common to AGS, or specific to certain types of computer hardware, wouldn't it?

For reference, I'm running an AMD 64 X2 Dual Core 6000+, 3.01 GHz CPU, 4 GB ram, Windows XP pro
#6
Yes, it happens in any textbox, including the save game textbox where you type the name of the game.  Does it not happen for you?  It doesn't happen in other applications outside of AGS for me, however. 

I actually tried lowering the keyboard repeat rate in control panel to the lowest level and it didn't make it any better. 
#7
Has anyone had a problem like this?  I have a textbox and I will type "hello" and it comes out "hhhelllllloooo", for example.  Is there a way to control this?  Thanks for your help.
SMF spam blocked by CleanTalk