Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Fri 15/07/2005 05:12:10

Title: Easter Eggs
Post by: on Fri 15/07/2005 05:12:10
I'm trying to create an easter egg in my game for example if the user presses the 8 and b key together it will display a message.  The problem is that I can't figure out how to tell the editor to trigger the message if BOTH the 8 and the b key are pressed.  Help!

p.s. Sorry for posting two comments in one day but I just registered for the fourms.
Title: Re: Easter Eggs
Post by: Gilbert on Fri 15/07/2005 05:24:48
Use the IsKeyPressed() function.

I'll recommend something like below to be placed in the repeatedly_execute() function:

if (IsKeyPressed('8')&&IsKeyPressed('B')) {
  //Do whatever you want here
}

Note also that you shouldn't make the combination too complicated, since some of the keyboards cannot register some of the multiple key combination pressed at the same time, but I think just checking if 2 keys are pressed simultaneously is okay for most of them.
Title: Re: Easter Eggs
Post by: Sam. on Sun 17/07/2005 19:32:24
surely a 3 button pressed detection is available on all keyboards, ctrl+alt+del?
Title: Re: Easter Eggs
Post by: Mr Jake on Sun 17/07/2005 22:47:47
Its type of keys, for example it doesn't detect W, D and S at the same time on my keyboard.
Title: Re: Easter Eggs
Post by: monkey0506 on Sun 17/07/2005 23:47:22
I think it registers Ctrl and Alt differently than other keys, which is why you can make keycode combinations using those keys.  Which is pretty much what Hotspot just said...but I don't know if it works with other keys like Home or F5.
Title: Re: Easter Eggs
Post by: Gilbert on Mon 18/07/2005 02:09:11
Yeah, it also depends on the keyboard, for example for my keyboard at home, it can register two arrow keys pressed simultaneously, but not with another key pressed together (eg. up+left+A).
Title: Re: Easter Eggs
Post by: Sam. on Mon 18/07/2005 22:00:53
well, that shows me.

I never had any problem with key bcombinations of any multitude. Althoiugh windows does like to interrupt with "stick key" warnings.
Title: Re: Easter Eggs
Post by: fovmester on Mon 25/07/2005 15:35:01
Quote from: Monkey Mage on Fri 15/07/2005 05:12:10
p.s. Sorry for posting two comments in one day but I just registered for the fourms.

I don't think you have to excuse yourself seeing that most people here post about 3 to 5 "comments" a day. :)
Title: Re: Easter Eggs
Post by: Shane 'ProgZmax' Stevens on Mon 25/07/2005 16:45:53
You'll also probably want to put a limit on what the easter egg does (if anything).  For example, if it gives you a score or a special item, you obviously don't want it doing that a second time, so use setglobalint and getglobalint (or a global of your choosing) to keep track on whether the easter egg has been accessed.  Also, since you've posted the combination in this thread, it would be a good idea to use a different one ;>.