Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 key combination
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DragonForce4




PostPosted: Sun May 31, 2009 7:49 am   Post subject: key combination

What is it you are trying to achieve?
A cheat code which requires the user to press certain keys one after another


What is the problem you are having?
I don't know how to do it


Describe what you have tried to solve this problem
I tried a big if statement


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

this is what did not work
Turing:

        if chars (KEY_UP_ARROW) then
            if chars (KEY_UP_ARROW) then
                if chars (KEY_DOWN_ARROW) then
                    if chars (KEY_DOWN_ARROW) then
                        if chars (KEY_LEFT_ARROW) then
                            if chars (KEY_RIGHT_ARROW) then
                                if chars (KEY_LEFT_ARROW) then
                                    if chars (KEY_RIGHT_ARROW) then
                                        if chars ('b') then
                                            if chars ('a') then
                                                %do cheat code stuff
                                            end if
                                        end if
                                    end if
                                end if
                            end if
                        end if
                    end if
                end if
            end if
        end if


Please specify what version of Turing you are using
4.1.1<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Sun May 31, 2009 8:39 am   Post subject: Re: key combination

Try storing the keys that have been pressed in a string and then checking the string against the answer. If they got the next key right, let them continue, if not, erase the string so they can start over.
Diablo117




PostPosted: Sun May 31, 2009 10:52 am   Post subject: Re: key combination

With that IF statement you would have to be clicking all 4 arrow keys as well as b and a for it to activate. I would put the key inputs into an array of string and manipulate the characters entered from there.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: