I want the CPS (clicks per second) to be displayed on my KeyStrokesMod at RMB and LMB when I click.
Does anyone have the code?
Would be very happy.
My code: https://gist.github.com/ScopeOut/231fcfff3a56ebb1a61e2e49844cd391
KeyStrokesMod
Related
In an fps I am trying to setup a hotkey such that when I am holding Lbutton (leftmouse), primary fire of a gun, and then tap RButton the LButton ceases and RButton commences. Ingame with no script, for other weapons, I get the desired result automatically. That is: I'm holding LButton, but if I also hold RButton 'after', the LButton ceases and the RButton's burst fire does its thing. However a different scoped weapon, with no script, freezes up when the above is done.
So I'm looking to, as soon as RButton is pressed, cease all user input of LButton until RButton's hotkey finishes.
~RButton
;Blockinput Mouse ;Send/Sendmouse
Send, {Click Left}{Click Right}{Click Left}
;BlockInput off
return
You can think of the Rbutton script as for a scoped rifle. Click Left activates scope, Click right fires it. Currently the desired behaviour only works when I completely remove my hand from LButton and then press RButton....I am also able to get ~LButton & ~RButton:: to work but that only covers the case when they r both first pressed at the exact same time, I want to cover the instance where LButton is pressed and held before RButton.
Ive tried applying blockinput, like seen above, had the UAC workaround to get it working, blocks certain things but doesnt seem to block any heldkeys when it is proc'd like the lbutton unless I'm missing something. If there was a "Freeze user input of LButton as soon as RButton procs, until RButton's script finishes" that would solve the problem I would think. I tried adding sleep delays, but they dont seem to help. The issue seems to be that LButton, when held, continues to proc when RButton first activates.
I used the below while holding LButton, and the sound DOES proc, so this must be possible to script.
*RButton::
Soundbeep
return
EDIT:
;code here works but only with that 100 sleep where i have to remove my hand from pressing the lbutton within 100ms of pressing rbutton.
*RButton::
GetKeyState, state, lbutton, p
if (state = "D")
{
soundbeep
send {Click Left Up}
sleep 100
;i need to actually disable the previous keypresses from it
}
Send, {Click Right}{Click Left}{Click Right}
return
From what I understood from your question, you don't really need to block user mouse input so much as Sending a Left MouseUp command if the Left mouse button was held down. I was having difficulty understanding what the end goal you were looking for was, but I wrote this based on what I was able to understand:
#SingleInstance Force
*RButton::
Soundbeep
If (getKeyState( "lbutton", "p" )){
Click, Left, Up
Send, {Click Left}{Click Right}{Click Left}
} else {
Send, {Click Left}{Click Right}{Click Left}
}
return
esc::ExitApp
UPDATE:
Based on the clarification from the comments of the question, this should work. Understood functionality: If the right mouse button is clicked while the left mouse button is held down, release the LMB, but do not suppress the RMB input.
*~RButton::
If (getKeyState( "lbutton", "p" ))
Click, Left, Up
return
UPDATE 2:
Now releasing the LMB before the RMB is pressed. I have a feeling that whatever game that you are playing will not be able to detect zero-tick switches between keystates, so I included a Sleep function that you can fine-tune/ remove as needed.
*RButton::
If (getKeyState( "lbutton", "p" )){
Click, Left, Up
Sleep 100
}
Click, Right, Down
KeyWait RButton
Click, Right, Up
return
I'm having problem with my work in blender, im using the latest version of the blende 2.78a.
But when i try to move my object and hit the x key then enter a value (2.50) it doesn't work.
Any help please =)
Did you first selected the object with right mousbutton and pressed the G key for moving the object?
If it still not works I have some other suggestions for you:
select the model, go to the panel on the right, press the "Object data" button (with the orange Cube on it) and then enter the numbers at "Location"
make sure you enter the numbers with a . not a , !!! (i also made this mistake)
press N to open an new propertiespanel on the right of the 3d-view and
look at the "Location"s; are the locks behind the coordinates blocked?
if so just click to unlock the positions
I desperately need help with a game I am making. For a bit of context, i am making a memory game and i have the following piece of code that is being troublesome. I have a bunch of labels on the form, 16 to be exact, with 1 randomly generated symbol placed in each. Each symbol appears in the labels twice.
------------------------------Continued----------------------------------------
'MsgBox("hello") 'used to check if the second inccorect press shows up - it does show but instantly changes colour
'''''''''''''''''NEED SOME CODE THAT PAUSES IT HERE'''''''''''''''
labels(0).ForeColor = Color.DarkRed
sender.ForeColor = Color.DarkRed
End If
flips = 1
End If
End If
tmrmemory.Enabled = True ' starts the timer after the user clicks the first label
End Sub
What's supposed to happen is that when the labels clicked don't match, it should show both the clicked labels for a short period before changing them both back to "DarkRed" which is the colour of the form's background.
I have tried using a timer but then i can't use sender.forecolor=color.darkred because it is not declared globally.
I have also tried using the command Threading.Thread.Sleep(500) but it still doesn't show the second incorrect click. I know that the code i have used works because when i use the message box, i can see both symbols and when the two clicks are correct, it stays.
Threading.Thread.Sleep(500) will actually pause your code for half a second. However during this time it won't do anything, not even refresh your controls. To get the effect you want, you need to call the YourControl.Refresh method before calling Threading.Thread.Sleep to force the control to redraw immediately.
On a side note, I would advise you not to call Threading.Thread.Sleep on UI thread. It will give a feeling of program hang. Instead do your work on a separate thread. You can either do all the work yourself right from creating a separate thread to destroying it, or use the BackgroundWorker control which has all the functionality built in.
Here is the link to an article I wrote a long time ago regarding BackgroundWorker that might be useful for you:
http://www.vbforums.com/showthread.php?680130-Correct-way-to-use-the-BackgroundWorker
Declare a variable outside the sub that stores what label should be flipped when the timer ends.
Label click sets
storedLabel = sender
Timer tick sets storedLabel.ForeColor = Color.DarkRed
So basically what the title says. I want to make a program where you click a button, and then another button shows up, and then if you click the next button in a certain amount of time you get a point.
This is what I found in another thread, but this also makes the timer count down before the second button even shows up, even though this code is after the code making the next button show up.
Do While DoWhileBool = True
Select Case DirectCast(Sender, Button).Name
Case "ClickHere2"
If TimeCount > 0 Then
MultCount += 1
End If
Case "ClickHere3"
If TimeCount > 0 Then
MultCount += 1
End If
This is not the full code by any means, but I just wanted to show what I tried that doesn't work for having a button click event in an if statement inside another button click method.
Edit: I ended up figuring it out partially but pretty much all of what I was asking thanks to the help of the answer:
NumButTim.Stop()
If TimerVar <> 0 Then
MultCount += 1
MultCounter.Text = MultCount
MultCounter.Refresh()
End If
NumButTim.Start()
TimerVar = 5
'Do Until TimerVar = 0
' TimerVar = Timer1.ToString
' TimeCounter.Text = Timer1.ToString
' TimeCounter.Refresh()
'Loop
End Sub
The commented section was where I was trying to get a textbox to show the countdown time, but it doesn't work. I'm sure I could figure it out if I wanted to, but I've moved on to other things. Thanks to the person who answered it, he probably led me to the right answer.
Sidenote: I don't use visual basic anymore, but the idea I had that this was a part of was sort of a mix of clicker game num pad typing and letter key typing and the typing would increase a multiplier for a while. Never really finished that idea and I don't even know if what I had made in that game even exists anymore because my external hard drive went kaput before I had transferred all the old files onto my current computer.
From what i understand of your question, this is how i would do it:
Add a timer, and 2 buttons to the form
On form load, you want to set the interval on the timer, so something like this:
Timer1.Interval = 1000 'Set the interval to 1 second
Then when you click on the first button show the second button, so on button1 click:
Button2.show() 'Show the second button
Timer1.Start() 'Start the timer, so they have 1 second from now
And in button 2 click, you want to do your event, add a point etc:
points += 1
Then to make the second button dissapear, (timeout) after a certian amount of time, you change the interval of the timer1. If the button wants to show for 1 second, set the interval to 1000 (milliseconds)
Then in timer1.tick add this code:
timer1.Stop() 'Stop the timer so that its not ran again and again
Button2.Hide() 'Hide the second button
MsgBox("You was too slow!!") 'Tell the user they missed it, or your code..
I am trying to select an entire line of text on a web page (in a table) using Sikuli. The easiest way to select the text is to "triple-click" on it. Is there a way to triple-click in Sikuli?
Thanks!
GregH,
I got the following to work for me:
click(img.png)
mouseDown(Button.LEFT)
mouseUp(Button.LEFT)
wait(0.01)
mouseDown(Button.LEFT)
mouseUp(Button.LEFT)
This allowed me triple click on a button, link, or whatever I needed to click on.
This works for me:
def tripleClick(PSMRL):
hover(PSMRL)
for x in xrange(3):
mouseDown(Button.LEFT)
mouseUp()
quick fix solution would be to check out the mouse settings in control panel and you can lower the time between clicks required to register successive clicks needed to perform the 'triple click' action
Have you tried low level mouse functions? Something like this should work:
for x in xrange(3):
region.mouseDown()
region.mouseUp()
Depending on what is being clicked, sometimes, the click type is the same as multiple clicks in succession. Meaning, if what needs to be clicked doesn't have to be double/triple-clicked very fast, then you can just use a sequence of single clicks. 2 clicks = double-click, 3 clicks = triple click. I know that 2 clicks will simulate a double-click on Windows desktop (not sure about things like games, etc.)
I've seldom heard of a triple-click action though.
So, have you tried using 3 clicks to simulate triple-click to see if that works or not?
I f you use .click() will be good enough.
.click() is the left mouse button, .rightClick() is the right mouse button.
For example:
image1 = ("image1.png")
def multiClick(nTime):
imageLoc = find(image1)
for n in xrange(nTime):
imageLoc.click()
# Click 3 times.
multiClick(3)