Page 1 of 2

a question

PostPosted: Wed Feb 09, 2005 4:04 am
by jj2197
I know how to catch two keys in a sequence. But can you catch as many keys in a sequence as you want.If yes, than can you tell me how to.

I'm new to game editor.

PostPosted: Wed Feb 09, 2005 10:14 pm
by willg101
I don't know either! I have the same question.

PostPosted: Fri Feb 11, 2005 7:24 pm
by makslane
Wait the 1.2.8 version. Will have a nice mode to catch multiple keys and make cheat codes! (will be released soon)

PostPosted: Fri Feb 11, 2005 9:34 pm
by jj2197
This dosen't solve my problem, Because I already bought It an I can't get anymore version updates.

PostPosted: Fri Feb 11, 2005 10:04 pm
by willg101
hahahaha
I have the exact same prob!

PostPosted: Sat Feb 12, 2005 3:41 am
by jj2197
So is there a way to do it, without the version update. So I don't need to buy it again.

PostPosted: Sun Feb 13, 2005 3:36 pm
by makslane
Try this:

- Add a Key Down event (any key, repeat disable)
- Put the Script:

Code: Select all
storeLastKey(getLastKey());

if(areLastKeys("cheat")) //Catch the cheat word
{
   
    x += 10;
}


And now, put this code in Global Code editor:

Code: Select all
#define MAXKEYS 20
int lastKeys[MAXKEYS];

void storeLastKey(int key)
{
   int i;
   for(i = MAXKEYS-2; i >= 0; i--)
   {
      lastKeys[i+1] = lastKeys[i];
   }

 
   lastKeys[0] = key;
 
}

int areLastKeys(char *s)
{
    int n = strlen(s), i;
    if(n >= MAXKEYS) n = MAXKEYS - 1;
    n--;
 
    for(i = 0; i <= n; i++)
    {
        if(s[i] != lastKeys[n - i])
        {
            return 0;
        }
    }
 
    return 1;
}

PostPosted: Sun Feb 13, 2005 5:51 pm
by jj2197
I couldn't get it to work.
I could only get it to work on a new
actor with just keydown (any key).

PostPosted: Mon Feb 14, 2005 1:28 am
by makslane
This must work in Key Down event of any actor.
What's happen?

PostPosted: Mon Feb 14, 2005 1:53 am
by jj2197
That's what I did.
It didn't work.

PostPosted: Mon Feb 14, 2005 2:30 am
by brutalDeluxe
:roll:

PostPosted: Tue Feb 15, 2005 2:36 pm
by makslane
Load the working sample here:
http://game-editor.com/examples/cheat.ged

PostPosted: Wed Feb 16, 2005 10:02 pm
by willg101
Thank-you soooo much!!!
This is so useful!

PostPosted: Thu Feb 17, 2005 3:55 am
by jj2197
Now how do I make more then one cheat.

PostPosted: Thu Feb 17, 2005 2:04 pm
by makslane
Just change the "cheat" string in the if(areLastKeys("cheat")) code