code help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
princesstwi
Posts: 26
Joined: 03 Dec 2013 12:34

code help

#1 Post by princesstwi » 10 Dec 2013 13:44

i was wondering if it is possible to make a batch code so they have to hit a certain key a certain amount of times with in a limited time if they dont they go to :fail if they do they goto :success

post code if possible if you dont want to post a code for it just tell me wether its possible or not

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: code help

#2 Post by ShadowThief » 10 Dec 2013 17:32

The easiest way to go about doing this would be to get the system time, have the user hit the key x number of times, get the system time again, and compare the two times, going to :fail if the difference between the two times is greater than whatever threshold you were thinking of.

However, I get the impression that you want the other kind of "do-a-thing-x-times-in-under-y-seconds" where the timer counts down while the user is hitting the button. I've never personally implemented anything like that, but I've seen topics on here about multithreading and Dave Benham's SNAKE game looks for key presses while the program is doing other things by using XCOPY, so it's definitely possible.

princesstwi
Posts: 26
Joined: 03 Dec 2013 12:34

Re: code help

#3 Post by princesstwi » 11 Dec 2013 09:13

thankyou for the reply thats what i needed to know :D

Post Reply