Old 05-20-2009, 04:47 PM   #1 (permalink)
Jr. Member
 
xCyberFang's Avatar
 
Join Date: Apr 2008
Posts: 449
xCyberFang will become famous soon enough
Send a message via AIM to xCyberFang Send a message via MSN to xCyberFang Send a message via Yahoo to xCyberFang
Default EXAMPLE: cheat code script.

this is a simple thing i made in about 10 minutes, and i thought id share it with everyone. to trigger the cheat codes, you press a sequence of directions and then press the pause/play button.

the example has 2 codes, the first one can be triggered by pressing up, down, up, down, play. it will bring up the music guide. the second code is empty.
feel free to edit and use as you desire.

Fields:
Code:
        bool leftisdown = false, rightisdown = false, upisdown = false, downisdown = false, bisdown = false;

        string cheatinput = "";
//make a new "cheatresult3 = false" for a new cheat result
        bool cheatresult1 = false, cheatresult2 = false;

Update:
Code:
if (!leftisdown && GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed)
                    leftisdown = true;

                if (leftisdown && GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Released)
                {
                    leftisdown = false;
                    cheatinput = cheatinput + "Left,";
                }

                if (!downisdown && GamePad.GetState(PlayerIndex.One).DPad.Down == ButtonState.Pressed)
                    downisdown = true;

                if (downisdown && GamePad.GetState(PlayerIndex.One).DPad.Down == ButtonState.Released)
                {
                    downisdown = false;
                    cheatinput = cheatinput + "Down,";
                }

                if (!rightisdown && GamePad.GetState(PlayerIndex.One).DPad.Right == ButtonState.Pressed)
                    rightisdown = true;

                if (rightisdown && GamePad.GetState(PlayerIndex.One).DPad.Right == ButtonState.Released)
                {
                    rightisdown = false;
                    cheatinput = cheatinput + "Right,";
                }

                if (!upisdown && GamePad.GetState(PlayerIndex.One).DPad.Up == ButtonState.Pressed)
                    upisdown = true;

                if (upisdown && GamePad.GetState(PlayerIndex.One).DPad.Up == ButtonState.Released)
                {
                    upisdown = false;
                    cheatinput = cheatinput + "Up,";
                }

                if (!bisdown && GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed)
                    bisdown = true;
DO NOT EDIT THE STUFF ABOVE, IT IS THE CORE BUTTON ENGINE.

the section below is still put within the update section, i cut it off to make it easier to find the parts you would change for the codes and functions.
Code:
                if (bisdown && GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Released)
                {
                    bisdown = false;

                    // CHEAT CODES SEQUENCES, ADD YOUR CHEAT CODE SEQUENCE HERE USING THE FORMAT FROM THE EXAMPLE BELOW

                    if (cheatinput == "Up,Down,Up,Down,")
                        cheatresult1 = true;

                    if (cheatinput == "Up,Down,Down,Up,")
                        cheatresult2 = true;



                    cheatinput = "";
                }

                if (cheatresult1)
                {
Guide.show();                    
cheatresult1 = false;
                }

                if (cheatresult2)
                {
                    cheatresult1 = false;
                }
__________________


Last edited by xCyberFang; 05-20-2009 at 04:51 PM.





xCyberFang is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old 05-22-2009, 08:20 AM   #2 (permalink)
Zuner
 
badmoodguy88's Avatar
 
Join Date: Jun 2008
Posts: 72
badmoodguy88 is on a distinguished road
Default

I like to have a counter that increases as long as a some key is held and have it resets to zero when released.

If it is on some little used menu where there is no reason to hold the key or key combo for ~10 seconds then it is hidden and easy to use and write.

(edited for horrible grammar)

Last edited by badmoodguy88; 05-23-2009 at 01:59 AM.



badmoodguy88 is offline   Reply With Quote
Old 05-22-2009, 11:25 AM   #3 (permalink)
Jr. Member
 
xCyberFang's Avatar
 
Join Date: Apr 2008
Posts: 449
xCyberFang will become famous soon enough
Send a message via AIM to xCyberFang Send a message via MSN to xCyberFang Send a message via Yahoo to xCyberFang
Default

Quote:
Originally Posted by badmoodguy88 View Post
I like to have a counter that increases as long as a some key is held and have it resets to zero when released.

If it is on works when on some little used menu where there is no reason to hold the key or key combo for ~10 seconds then it is hidden and easy to use and write.
you know i actually had something similar to a timer on the first attempt at making this (i used a different style for the coding tho, and but that one didnt work), and when you entered a button in, it would start the timer, and if you hit a second button it would reset the timer back to 0 (still going tho), and if you didnt press something when it hit the timer length it would erase the code. i might just insert that code into this version. i will do it later tho. right now im busy with ZuneTools.
__________________






xCyberFang is offline   Reply With Quote
Reply

Bookmarks

Thread Tools