double click mouse...?

I am matching of graphical adventures, and need that my actor responds of different way from click of the left button from mouse to a double click
click left button mouse:WALK
double click left button mouse:RUN

i try with logical bricks and a time property but I am not myself.
this dont work.

thanks for any aid:)

Note: I’m a little drunk, and it’s a little late, so sorry if it comes out all retarded :rolleyes:.

I’ll give it a try though (didn’t use the code tags for some time, :smiley:):

#Logic Brick setup:
#Mouse Sensor---->Python
#Timer prop named "time" (<i>no quotes</i>)
#Int prop named "mstate" (<i>no quotes</i>)
#Int prop named "mcount" (<i>no quotes</i>)

cont = GameLogic.getCurrentController()
own = cont.getOwner()

#The mouse sensor:
mclick = cont.getSensor("mousesensorname")

if own.mcount == 0: #Keep time at bay
    own.time = 0

if mclick.isPositive() and own.mstate == 0:
    own.mcount += 1
    own.mstate = 1 #So that it won't keep going 

#Until you let go:
if not mclick.isPositive():
    own.mstate = 0

#How much time do you allow for double click? (<i>I chose 0.5sec</i>)
if own.time &gt; 0.5 or own.mcount == 2: #or dclick resets regardless
    if own.mcount == 1:
        #send walk message to player
    if own.mcount == 2:
        #send run message to player
    #The reset:
    own.time = 0
    own.mcount = 0

Hope this helps you out.


You create a properti which go from 20 to zero when you simple click
and you test is this condition is > 0 and mouse click is Positive
so you’ve got a db click

I don’t see how that will work. I mean what’s stoping me from just holding the mouse button down with one click. According to what you wrote, that would still register as a dclick. Actually, I don’t see how you would differentiate a click from a dclick there.

Add more detail to your statement.

Thanks Very Much Social…for You Script…
Most Later Post The Blend File …
For See Your Script Working

Ps: My English Is Very Crazy Because I Am Spanish For The Argentine And Dont Write English Very Good.:frowning:
I Use Multitranse Soft For Write In This Forum;)

No problem, I’m glad it all worked out.

Good luck.