Cheat Code

Game Editor comments and discussion.

Cheat Code

Postby ingsan » Sun Mar 07, 2004 10:11 am

i think that putting a cheat code in GE games is actually possible. :? Well i actually don't know how i'm gonna manage that, but it would be interesting if we ponder about it.

To start, maybe we should ask ourself :

Code: Select all
if i press this key, then that one, and then that other one, it makes This
:?

i don't know if someone can help me, but if anyone's got an idea, i will forever be gratful to him, or her... :wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby jazz_e_bob » Sun Mar 07, 2004 10:05 pm

Broad Overview? :)

We need to create a keypress string that contains the most recent keys pressed.

When a new key is hit it is added to the end of the string. The first character in the list is deleted.

We then need to scan that list at regular intervals for "cheat" sequences and, if one is found, apply the appropriate cheat.

The scan routine could be a simple strstr.

Does GE support strstr? Maybe not... hmmm

Image

Anyway...

strstr will find a sub-string within a string.

Library: string.h

Prototype: char * strstr(const char *s1, const char *s2);

Syntax: char string1[]="red dwarf";
char string2[]="dwarf";
void *pointer;
pointer = strstr(string1, string2);

strstr returns a pointer to the beginning of the sub-string or NULL if not found.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby ingsan » Mon Mar 08, 2004 11:27 am

:) Great jazz-e-bob. Well i got to say that i quite did not understand most of what u said, but it puts me on the track. 8)

I'm gonna ponder on that and try to make some research to understand more about that C function.

Thank you very very much. :wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron