Page 1 of 1

Custom Input Text Errors?

PostPosted: Thu Jan 28, 2010 5:41 pm
by Hblade
I found a work around this thats less coding as well :D

DUDE I CANT SEEM TO TURN MY HEAD WITHOUT ANOTHER PROBLEM!

This one is VERY weird! For some reason (no matter what key I press), there are 2 keys that type out with this code, those keys are "I" and "M" Even backspace for SOME unknown reason. Heres the code, it's in a key down event, with "any key" as the keys I'm doing it this way for a reason.
Code: Select all
char *key=GetKeyState();
if (inputting_name == 1)
{
    //Lower case keys
    if (strlen(text)<9)
    {
        if (key[KEY_a] == 1)
        {
            strcat(text, "a");
        }
        if (key[KEY_b] == 1)
        {
            strcat(text, "b");
        }
        if (key[KEY_c] == 1)
        {
            strcat(text, "c");
        }
        if (key[KEY_d] == 1)
        {
            strcat(text, "d");
        }
        if (key[KEY_e] == 1)
        {
            strcat(text, "e");
        }
        if (key[KEY_f] == 1)
        {
            strcat(text, "f");
        }
        if (key[KEY_g] == 1)
        {
            strcat(text, "g");
        }
        if (key[KEY_h] == 1)
        {
            strcat(text, "h");
        }
        if (key[KEY_i] = 1)
        {
            strcat(text, "i");
        }
        if (key[KEY_j] == 1)
        {
            strcat(text, "j");
        }
        if (key[KEY_k] == 1)
        {
            strcat(text, "k");
        }
        if (key[KEY_l] == 1)
        {
            strcat(text, "l");
        }
        if (key[KEY_m] == 1);
        {
            strcat(text, "m");
        }
        if (key[KEY_n] == 1)
        {
            strcat(text, "n");
        }
        if (key[KEY_o] == 1)
        {
            strcat(text, "o");
        }
        if (key[KEY_p] == 1)
        {
        strcat(text, "p");
        }
        if (key[KEY_q] == 1)
        {
        strcat(text, "q");
        }
    }
    //Backspace and Space keys
    if (key[KEY_BACKSPACE] == 1)
    {
        if (strlen(text)>0)
        {
            strcpy(&text[strlen(text)-1], "");
        }
    }
}

Re: Custom Input Text Errors?

PostPosted: Thu Jan 28, 2010 6:13 pm
by makslane
Try use:
strcpy(&text[strlen(text)-1], " ");

Re: Custom Input Text Errors?

PostPosted: Tue Feb 02, 2010 6:00 am
by Bee-Ant
Or use this method :
-) Make variables :
Code: Select all
char Text[8];
int text_index;

-) TextActor->CreateActor
Code: Select all
int i;
for(i=0;i<8;i++)
{
    strcpy(Text[i]," ");
}

-) TextActor->DrawActor
Code: Select all
sprintf(text,"%s%s%s%s%s%s%s%s",Text[0],Text[1],Text[2],Text[3],Text[4],Text[5],Text[6],Text[7]);

-) TextActor->Keydown->Any Key
Code: Select all
strcpy(Text[text_index],getKeyText(getLastKey()));
text_index++;

Re: Custom Input Text Errors?

PostPosted: Tue Feb 02, 2010 5:33 pm
by Hblade
Awesome, now do you know of any way I can apply a blinker to this? :D

Re: Custom Input Text Errors?

PostPosted: Tue Feb 02, 2010 6:36 pm
by Bee-Ant
A blinker?
I dont know with animated blinker, but you may could add this :
- change the array size of Text to 9. Text[9]
- add this code in the DrawActor :
Code: Select all
strcpy(Text[text_index+1],"|");

Re: Custom Input Text Errors?

PostPosted: Tue Feb 02, 2010 7:25 pm
by Hblade
I tried an animated blinker, but when ever I pressed a key (while the blinker was being displayed), it applied the blinker as well so you see a big line in the sentence xD

Re: Custom Input Text Errors?

PostPosted: Wed Feb 03, 2010 3:45 am
by Bee-Ant
It seems, i need to make a demo...

Here

Re: Custom Input Text Errors?

PostPosted: Wed Feb 03, 2010 2:34 pm
by Hblade
Lol, you forgot the .ged, you have the .undo file lol...

Re: Custom Input Text Errors?

PostPosted: Thu Feb 04, 2010 2:25 am
by Bee-Ant
Oh, sorry...
Here's

Re: Custom Input Text Errors?

PostPosted: Fri Feb 05, 2010 2:45 pm
by Hblade
Thanks but now I cant view it lol. I dont have GE anymore :O I'm trying my best to get a virtual machine to run atleast decent on Ubuntu :D
This is an old computer. I know if I had Debian, it'd run smooth but Ubuntu has performance issues :D

Re: Custom Input Text Errors?

PostPosted: Wed Feb 10, 2010 1:48 am
by Hblade
Lol dont press backspace o.o