Double-Count

Has anyone noticed that when using expressions the game engine counts it as if you pressed the button twice. If you have this problem, do you know a fix for it?

-Ragchan

It would be nice to provide an example.

Here you go

http://www.savefile.com/files/979499

HI RACHAN
here is example of script write for SOCIAL
write some time ago
for the double click in the left botton of mouse.
here the example blend
one click: WALK
dowuble click: RUN
http://www.savefile.com/files/979786
and here the code of social:


import GameLogic as g
cont = g.getCurrentController()
own = cont.getOwner()
mclick = cont.getSensor("mouse")
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 chose 0.5sec)
if own.time > 0.3 or own.mcount == 2:
 
  if own.mcount == 1:
  own.estado = "WALK"
  if own.mcount == 2:
  own.estado = "RUN"
  own.time = 0
  own.mcount = 0

Heh, the “code of social” would be properly indented.

ragchan>

Use python instead of bricks.

In your expression box, instead of “propname = FALSE”, it should be “IF yoursensorname(propname = FALSE)” — no quotes. This will get rid of the double counts. Don’t use spaces in your sensor name.

You can also write expressions like this: “IF sensname(prop = TRUE AND prop1 < 10)” or “IF sensname(prop = TRUE OR prop1 = FALSE)”.

is it possible to use it for combo ?

Black reaper, Im not sure what your talking about, please elaborate.

S_Cross, Thanks alot, It solved my problem.