The Daily Click ::. Forums ::. Klik Coding Help ::. Lil' question aboot MMF.
 

Post Reply  Post Oekaki 
 

Posted By Message

Bakaman



Registered
  21/05/2004
Points
  3
6th March, 2005 at 05:57:44 -

Hullo peeps. I'd like to know how to do the following:
i.e. a code or something similar where you have to press keys in order for something to happen, like a-b-c-d and then a door opens or something. I don't know how to do that, when i try doing that, it makes it so that the user can press d-c-b-a and the door opens. So i need to know how to make it so that you have to press the buttons in order. This will be used in my upcoming "mooRPG", so please help meeeee. thx

 
Zuh?

Phredreeke

Don't listen to this idiot

Registered
  03/08/2002
Points
  4504

You've Been Circy'd!VIP MemberPS3 Owner
6th March, 2005 at 06:13:55 -

make a counter and

if counter is 0 and player press a then set counter to 1
if counter is 1 and player press b then set counter to 2
and so on...

then you might want to include something like this
if counter isn't 0 and player press a then set counter to 0
if counter isn't 1 and player press b then set counter to 0
and so on...

this make sure it resets if you press the wrong key.

 
- Ok, you must admit that was the most creative cussing this site have ever seen -

Make some more box arts damnit!
http://create-games.com/forum_post.asp?id=285363

Bakaman



Registered
  21/05/2004
Points
  3
10th March, 2005 at 11:22:19 -

The first part (if counter is 0 and player press a then set counter to 1 etc) works fine but the second part (if counter isn't 0 and player press a then set counter to 0 etc) doesn't work for some reason.
Even though I tried different ways of doing it, it still just wont set it back to 0. O__o
Is there any other way of doing that?

 
Zuh?

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
10th March, 2005 at 13:47:44 -

Because counter isn't 0 whe you press 1, it resets to 0 anyway. Try this instead:

When player presses A + flag 1 = off: Set flag 1 on.
When player presses B + flag 1 is on and flag 2 is off: Set flag 2 on.

I can't figure the reset thing out either...

 
Old member (~2004-2007).

Noyb



Registered
  31/05/2004
Points
  1117

VIP Member
10th March, 2005 at 14:48:06 -

Have the program reset when the player presses a key other than what is expected. Use the "press any key" condition, along with a negation of "player pressed key __". Example based on first post:
Player presses "A" & counter = 0, set counter to 1.
Player presses "B" & counter = 1, set counter to 2.
Player presses any key & Player doesn't press "B" (use negate) & counter = 1, set counter to 0.
Player presses "C" & counter = 2, set counter to 3.
Player presses any key & Player doesn't press "C" (use negate) & counter = 2, set counter to 0.
Player presses "D" & counter = 3, set counter to 4.
Player presses any key & Player doesn't press "D" (use negate) & counter = 3, set counter to 0.
This is basically the code I used to make a "cheat" hidden in the main screen of Independence.

Image Edited by the Author.

 
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames

DistantJ [FZ Games]



Registered
  02/08/2004
Points
  855
12th March, 2005 at 07:35:38 -

If you wan't to do this multiple times in the game, you can make life a little easier using the string parser and control x objects.

Upon pressing any key: Set value of String Parser to string$("String Parser") + LastKeyPressed$("Control X")

(Compare two general values) Right$(upper$("String Parser"), 4) = "ABCD": Set value of String Parser to " ", Open Door.


Explanation:

"Right$...4)" Gets the 4 rightmost letters of the String Parser's text. Changing the number will change the amount of letters from the right to go, so if you wanted a longer chain of letters, you'd set the number higher.

The "...(upper$..." gets the text from the String Parser as capitals, meaning it won't matter weather the user has caps lock on or off or was holding shift or not.

"Set value of String Parser to " "" Isn't actually necessary, it just resets it to save memory so you're not handling a huge long string. Add this action in other places if you can just so that it is reset every now and then.

This sounds more complicated at first but then when using more than one code it can be far easier.

This can also work with button combo's on a gamepad, which makes it great for combo button attacks or cheats. All you need to do is replace the first event with an event for each button (e.g. Joystick pressed up: Set value of String Parser to string$("String Parser") + "Up", repeat for other directions and fire buttons) then when detecting the string use for example Right$("String Parser", 4) = "UpDownLeftRightFire1Fire2". No need for upper$ when doing it this way.

 
http://www.fzgames.com

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
12th March, 2005 at 17:08:38 -

If you have MMF, you don't need to use String Parser. If you use DistantJ's method, you could have one long string if they never get ABCD. Here's a simple way of doing it (though probably not the best)
Upon pressing any key --> Set string$("String") to string$("String") + LastKeyPressed$("Control X")

string$("String") = "ABCD" --> *set on/off the cheat* || Set string$("String") to ""
string$("String") <> "A" || string$("String") <> "AB" || string$("String") <> "ABC" || string$("String") <> "ABCD" --> Set string$("String") to 0.


 
http://www.klik-me.com

DistantJ [FZ Games]



Registered
  02/08/2004
Points
  855
12th March, 2005 at 17:25:38 -

Yeah but that method requires a lot of work for just one code. With mine once you've programmed the main events you just need to copy the one event and change the "ABCD" to the new code. You can reset the string whenever you want to ensure it's not too long.

 
http://www.fzgames.com
   

Post Reply



 



Advertisement

Worth A Click