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
Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support
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
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.
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.
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
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
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
reneuend wrote:
[/code]
Return to Adventure Maker Technical Support and Bug Reports
Users browsing this forum: No registered users and 0 guests