Disable a key ????

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Disable a key ????

Postby Simon » Tue Dec 18, 2012 4:52 pm

Hi... I'm somehow desperate : I have one last issue to fix in ASA, but I just can't find a solution.
ASA was supposed to release this month, but time passes and it will be christmas before I could do anything...

--> If someone knows of a way to disable a key (right-click, escape key) when I want in my game, please tell me now ! :oops:
Keyguard would be great, but problem : it can assign an action to a specific key, but it cannot desactivate a specific key...
What I want is that, on certain frames I choose, the right click is disabled so the inventory doesn't show ! Idem for the escape key and the top menu.

Please help :!:
Thanks...
User avatar
Simon
Expert Member
 
Posts: 418
Joined: Sun Jun 10, 2012 1:47 pm
Location: France

Re: Disable a key ????

Postby reneuend » Wed Dec 19, 2012 4:30 am

The way to deactivate a key with keyguard is with a flag. When someone presses a key that deactivates, set the flag. Now, just be sure to test the flag when it goes into the Keyguard subroutines. I did this in my previous example. I'll try to get you the code based on what you want by the end of this week. My family is going down like flies with the flu and its taking up all my time to help out. Please hang in there just a couple more days!
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: Disable a key ????

Postby Simon » Wed Dec 19, 2012 10:51 am

OK that's somehow helping me to know I need to use a "flag".
A flag... mmh... sounds chinese to me in programmation, but if I look on the net, they say it's a variable which can take 2 values.

Makes me think of the other code you posted :
Code: Select all
    sub KeyGuard_MouseButtonPressed(KeyID)

    ...
    ...
    ...

    If rightkey_activate = 1 then
        rightkey_activate = 0
    else
        rightkey_activate = 1
    end if



In the sub ProcessMouseClick, you will want to check this variable:

Code: Select all
Code: Select all
    If rightkey_activate = 1 then
      'If right-click
        If suppress_inventory = 0 Then
          If KeyID = 100 Then
    ....
    ....
    ....
    ....


So, if I use this, it should disable the right click ?
I'll try again then, maybe I missed something and that it is the solution.
Thanks again reneuend.
User avatar
Simon
Expert Member
 
Posts: 418
Joined: Sun Jun 10, 2012 1:47 pm
Location: France

Re: Disable a key ????

Postby reneuend » Wed Dec 19, 2012 1:50 pm

Good Job!!! Maybe you should consider trying programming!! :mrgreen:
You are correct. The first example is a prime example of using a flag.
I could have used a variant instead of an integer variable and set the value to true or false, but using 1 and 0 is a typical alternative.

------------------------------------------
Alternatively....

There is also the new checkboxes in the Project Properties:
- Hide cursor when a video is playing
- Do not let the user skip videos (except with the escape key)

Have you tried these options???
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: Disable a key ????

Postby Simon » Wed Dec 19, 2012 3:04 pm

The new checkboxes :
Yes, of course, I use them in the Beta2 of ASA...
User avatar
Simon
Expert Member
 
Posts: 418
Joined: Sun Jun 10, 2012 1:47 pm
Location: France


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests