Custom Input Text Errors?

Non-platform specific questions.

Custom Input Text Errors?

Postby Hblade » Thu Jan 28, 2010 5:41 pm

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], "");
        }
    }
}
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Custom Input Text Errors?

Postby makslane » Thu Jan 28, 2010 6:13 pm

Try use:
strcpy(&text[strlen(text)-1], " ");
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Custom Input Text Errors?

Postby Bee-Ant » Tue Feb 02, 2010 6:00 am

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++;
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: Custom Input Text Errors?

Postby Hblade » Tue Feb 02, 2010 5:33 pm

Awesome, now do you know of any way I can apply a blinker to this? :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Custom Input Text Errors?

Postby Bee-Ant » Tue Feb 02, 2010 6:36 pm

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],"|");
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: Custom Input Text Errors?

Postby Hblade » Tue Feb 02, 2010 7:25 pm

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Custom Input Text Errors?

Postby Bee-Ant » Wed Feb 03, 2010 3:45 am

It seems, i need to make a demo...

Here
Attachments
TextInput.zip
(22.07 KiB) Downloaded 49 times
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: Custom Input Text Errors?

Postby Hblade » Wed Feb 03, 2010 2:34 pm

Lol, you forgot the .ged, you have the .undo file lol...
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Custom Input Text Errors?

Postby Bee-Ant » Thu Feb 04, 2010 2:25 am

Oh, sorry...
Here's
Attachments
TextInput.zip
(20.63 KiB) Downloaded 61 times
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: Custom Input Text Errors?

Postby Hblade » Fri Feb 05, 2010 2:45 pm

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Custom Input Text Errors?

Postby Hblade » Wed Feb 10, 2010 1:48 am

Lol dont press backspace o.o
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest