Disable the right mouse button for 5 seconds!!!

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

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

Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Wed Sep 24, 2014 2:29 am

I need help
Is there any way to disable the right mouse button for 5 seconds.
After 5 seconds it returns to be active to use.
Thank you
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Re: Disable the right mouse button for 5 seconds!!!

Postby reneuend » Thu Sep 25, 2014 2:35 am

I know this can be done easily with KeyGuard. Unfortunately, my keyGuard is throwing errors without any code. Not sure why.

Here is what I think will work:

1. Create an integer variable called: disable
2. Enter the following code in the Advanced tab - Procedures...

Code: Select all

sub KeyGuard_MouseButtonPressed(KeyID)
   ProcessMouseClick GetCurrentFrameName, KeyID(0)
   'Action.message "mouse: " & KeyID(0)
End Sub

sub ProcessMouseClick(CurrentFrame, KeyID)
  'If right-click
  If KeyID = 100 Then
   If CurrentFrame = "Test Right Mouse Button" Then
      Process_PauseRightMouseButton()
   End If
  End If
End Sub

sub Process_PauseRightMouseButton()
disable = 1
Msgbox "disabled"
Action.CreateTimedEvent 5, "disable=0:Msgbox ""enabled""",false
end sub


What happens:

When the player clicks on the right-mouse button, the system checks to see if the current frame = "Test Right Mouse Button". If it does, then the Process_PauseRightMouseButton() routine is called, which sets the disable flag = 1. The CreateTimedEvent command pauses 5 seconds and then it resets the disable flag = 0 and it displays a message that the right mouse is enabled.

The reason for the flag is if the player keeps clicking on the right mouse button before the 5 seconds is done, you don't want to keep processing the CreateTimedEvent.

Let me know if this works. I wasn't able to test it.
---


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

Re: Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Thu Sep 25, 2014 2:43 pm

reneuend wrote:I know this can be done easily with KeyGuard. Unfortunately, my keyGuard is throwing errors without any code. Not sure why.

Here is what I think will work:

1. Create an integer variable called: disable
2. Enter the following code in the Advanced tab - Procedures...

Code: Select all

sub KeyGuard_MouseButtonPressed(KeyID)
   ProcessMouseClick GetCurrentFrameName, KeyID(0)
   'Action.message "mouse: " & KeyID(0)
End Sub

sub ProcessMouseClick(CurrentFrame, KeyID)
  'If right-click
  If KeyID = 100 Then
   If CurrentFrame = "Test Right Mouse Button" Then
      Process_PauseRightMouseButton()
   End If
  End If
End Sub

sub Process_PauseRightMouseButton()
disable = 1
Msgbox "disabled"
Action.CreateTimedEvent 5, "disable=0:Msgbox ""enabled""",false
end sub


What happens:

When the player clicks on the right-mouse button, the system checks to see if the current frame = "Test Right Mouse Button". If it does, then the Process_PauseRightMouseButton() routine is called, which sets the disable flag = 1. The CreateTimedEvent command pauses 5 seconds and then it resets the disable flag = 0 and it displays a message that the right mouse is enabled.

The reason for the flag is if the player keeps clicking on the right mouse button before the 5 seconds is done, you don't want to keep processing the CreateTimedEvent.

Let me know if this works. I wasn't able to test it.


I have not installed the KeyGuard this game I'm making.

What happens is that if you click the left button on the mouse I go to the inventory.
When I put the diesel in the boat play a sound for 3 seconds.
But if you click the left button to go to the inventory before 3 seconds.
The game gets stuck and can not get out.
This video shows the bug
http://youtu.be/HYQ82BCHPYI
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Re: Disable the right mouse button for 5 seconds!!!

Postby reneuend » Thu Sep 25, 2014 11:44 pm

Are you getting Left and Right mouse click confused? Your last post didn't seem correct.
I tried to understand the issue from the video, but it's harder without actually trying it myself.
Since I don't know how you are managing the right-click, I really can't be of much help. I would think that you would still use the same concept I explained, regardless if you are using Keyguard or not.

- use a variable as a flag so you know when to disable and when to enable
- use CreateTimedEvent to set the flag and in a condition to either display the menu when disable variable = 0; otherwise, don't allow the menu to be used.
---


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

Re: Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Fri Sep 26, 2014 12:53 am

reneuend wrote:Are you getting Left and Right mouse click confused? Your last post didn't seem correct.
I tried to understand the issue from the video, but it's harder without actually trying it myself.
Since I don't know how you are managing the right-click, I really can't be of much help. I would think that you would still use the same concept I explained, regardless if you are using Keyguard or not.

- use a variable as a flag so you know when to disable and when to enable
- use CreateTimedEvent to set the flag and in a condition to either display the menu when disable variable = 0; otherwise, don't allow the menu to be used.


click a hotspot >>> for 5 seconds right mouse button disable.
5 seconds later he comes back enable.

Thanks for helping me
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Re: Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Fri Sep 26, 2014 2:50 pm

What is the command to disable the right mouse button?
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Re: Disable the right mouse button for 5 seconds!!!

Postby reneuend » Fri Sep 26, 2014 11:12 pm

If you can capture the right click event then you can use the code I outlined in the earlier post. How are you capturing the right click event?

[Update] How are you causing your menu to display on the mouse right-click? If you are somehow working with the right-click for AM's menus then you can just disable AM's menus for 5 seconds instead using the Action.CreateTimedEvent command.
---


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

Re: Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Sun Sep 28, 2014 3:51 pm

The problem is
Clicking the hotspot where you use the barrel of diesel.
Plays a Gasoleo.avi video and mark the variable n1_BidonR
Image

But if you click right-click before ending the video Gasoleo.avi
Go to the inventory and the game gets stuck.
Image

How not to use the inventory when the video plays ???
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Re: Disable the right mouse button for 5 seconds!!!

Postby reneuend » Sun Sep 28, 2014 4:28 pm

From your screen shots, I don't see how n1_Bidon2 will ever equal "1"
n1_BidonR is changed to "1", but I don't see where it does anything based on this change.


A possible quick and dirty fix:
Have you tried using the following option?

From Project Properties
- Options Tab
- [x] Do not let the user skip videos (except with the Escape key)



The better option would be to use VB Scripting.
Variable:
- Disable_GasCan Integer

Hotspot Properties - Advanced Tab
Code: Select all
       if Disable_GasCan = 0 then
            PlayVideoWin7("Gasoleo.avi",0,10)
            Action.GoToFrame "inventario"  'Might have to put this in a CreateTimedEvent command, but not sure!
            Disable_GasCan = 1
        End If



From Advanced Tab - Procedures:
Code: Select all
Sub PlayVideoWin7(VideoFile, NumRepeat, ChannelNumber)
   If ChannelNumber < 9 Then
      'With VBScript it is currently not possible to interact with the 8 first video channels.
      MsgBox "The specified video channel is invalid.", vbCritical, "Error"
      Exit Sub
   End If
   If Action.IsComponentInstalled("NSPlay.NSPlayCtl.1") = False Then
      MsgBox "Unable to find the media player component.", vbCritical, "Error"
   Else
      If Action.DoesComponentExist("MediaPlayer" + CStr(ChannelNumber)) = false Then
         AddComponent "NSPlay.NSPlayCtl.1", "MediaPlayer" + CStr(ChannelNumber)
      End If
      Component("MediaPlayer" + CStr(ChannelNumber)).Object.FileName = VideoFile
      Component("MediaPlayer" + CStr(ChannelNumber)).Object.PlayCount = NumRepeat
      Component("MediaPlayer" + CStr(ChannelNumber)).Object.Play
   End If
End Sub
---


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

Re: Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Sun Sep 28, 2014 9:20 pm

reneuend wrote:From your screen shots, I don't see how n1_Bidon2 will ever equal "1"
n1_BidonR is changed to "1", but I don't see where it does anything based on this change.


A possible quick and dirty fix:
Have you tried using the following option?

From Project Properties
- Options Tab
- [x] Do not let the user skip videos (except with the Escape key)



The better option would be to use VB Scripting.
Variable:
- Disable_GasCan Integer

Hotspot Properties - Advanced Tab
Code: Select all
       if Disable_GasCan = 0 then
            PlayVideoWin7("Gasoleo.avi",0,10)
            Action.GoToFrame "inventario"  'Might have to put this in a CreateTimedEvent command, but not sure!
            Disable_GasCan = 1
        End If



From Advanced Tab - Procedures:
Code: Select all
Sub PlayVideoWin7(VideoFile, NumRepeat, ChannelNumber)
   If ChannelNumber < 9 Then
      'With VBScript it is currently not possible to interact with the 8 first video channels.
      MsgBox "The specified video channel is invalid.", vbCritical, "Error"
      Exit Sub
   End If
   If Action.IsComponentInstalled("NSPlay.NSPlayCtl.1") = False Then
      MsgBox "Unable to find the media player component.", vbCritical, "Error"
   Else
      If Action.DoesComponentExist("MediaPlayer" + CStr(ChannelNumber)) = false Then
         AddComponent "NSPlay.NSPlayCtl.1", "MediaPlayer" + CStr(ChannelNumber)
      End If
      Component("MediaPlayer" + CStr(ChannelNumber)).Object.FileName = VideoFile
      Component("MediaPlayer" + CStr(ChannelNumber)).Object.PlayCount = NumRepeat
      Component("MediaPlayer" + CStr(ChannelNumber)).Object.Play
   End If
End Sub


I just want to disable the right mouse button.
What is the code to disable the right mouse button?
Simple code please
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL

Re: Disable the right mouse button for 5 seconds!!!

Postby PINGO TINTO » Mon Sep 29, 2014 12:43 am

reneuend wrote:
[/code]

I think I've decided.
Pulling the frame through the Advanced does not bug.
Image

This was all because of a girl to play click several buttons at the same time.
And when there is a video by clicking the mouse several times the game got stuck.

Anyway, thank you reneuend
User avatar
PINGO TINTO
Advanced Member
 
Posts: 182
Joined: Wed Jun 17, 2009 6:17 pm
Location: PORTUGAL


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron