All the code is in the Page's On Timer Event. It's very straight forward and you should be able to figure it out from there. You'd probably want to use it in conjunction with the mouse.dll I posted to detect when the user clicks the left mouse button so you know what color is actually being picked.
Originally posted by mke0075
thnx please explain that howcan i do that example, and how i can use this example in my applaction
I am still a bit thinkering around my reaction time application. The problem is that capturing keybord events adds about 40-50 msec to the registred reaction time wich is not really acceptable. Special purpose keypads use a microcontroller timer and intelligent protocols and bring down the variance to 1 msec precision wich is of course excellent (even slightly overkill) but are very expensive. It seems that mouseclicks or gamepads only add about 4-5 msec. Is anybody aware if this statement is true ? As I would like to use this program for evalution of driving capacity (time to hit the brake on visual and acoustical warning signal) I am wondering if I could use the same game devices I see some guys use in these (fanbtastic :-) games like microsoft wheel and pedals devices. problem : how to call these from ams pro ?,
Iím with you in wishing for a way to capture feedback from joysticks, etc.
On a slightly different note, Iím a bit curious about the this keyboard latency issue. I might be wrong here, but I think that the 40-50 msec comes not from the speed of the physical switches on the keyboard, but rather the amount of time it takes to run the code necessary to process the data.
If this is indeed the case, I donít understand how a gamepad would reduce this latency to 4 Ė 5 msec. Wouldnít the amount of latency be more closely tied to the amount of code (logic) needed to process or capture the button click?
If my assumptions are true, I canít see where we can come up with the 4-5 msec numbers. I mean, we donít have the code necessary to capture button clicks on a gamepad. Will the code be three lines long, or thee thousand lines long?
Iím truly not trying to give you a bad time here. Iím not smart enough to provide the code to use gamepads, so Iím trying to think of an alternate method.
You mention that using a keyboard results in 40 Ė 50 msec of latency. I wonder if it would be possible for an end user to calibrate his particular machine.
For instance, before a user takes the test, they must go through calibration. Calibration might consist of a count down timer. The timer (in big bold numbers) starts at 10, then counts down to 0 at even 1 second intervals. The user tries to click the space bar at the exact instant that the clock reaches 0. I wonder if the user was to take this calibration test say three times, and the latency was measured and averaged between the three times, if it might not allow you to figure that particular machinesí latency.
After you calibrate the latency, subtract that number from the test answers.
Sorry I canít give you the answer you are looking for.
Thanks for the good ideas and Your input on discussing this . I am not at all an expert myself on this topic but managed to find some bits and pieces of documentation. The 40-50 msec delay seems to have to do with the fenomenon of "bouncing" key's and this is specific to the way keys on a keyboard are constructed (spring mechanism) and operate. Once captured and stored in a buffer these values have to be stored in registry, catched by layers of windows buffers and functions before they "enter" in the e_keyevent variable where they are then available for our programs and action scripts. This last part of the traject is indeed the same for mouse clicks and gamepad triggers but the previous part seems to be quite diferent ( I do not have details on this but am looking further into it). The procedure that You are proposing is already a (compex) reaction time measurement paradigm in itself as anticipation enters in te setup. Indeed a user will anticipate the time necessary for going fron the last "1" to the "zero" number wich triggers his reaction. But it is indeed generally a good idea that has been incorporated at machine level by the microcontrollers I was mentioning (expensive 1 msec accuracy systems). They have low level calibration routines where they send a byte to the hostPC that has to send it back. That allows to calculate and compensate for any host specific "low level" delay's (nice trick). Following Your suggestion a "higher level" calibration procedure could take advantage of the page.timer and on page.time event automatically trigger the reaction start event and calculate mean and standard deviation of the delay. Thanks for the feed back. Discussing this sparkles idea's.
PS I just subscribed to the developer section of Logitech in order to get their developers kit wich hopefully can make the proces of interfacing their devices a bit more friendly.
Thanks for the explanation. I understand a bit better now. It surprises me that the additional latency is in fact from the keyboards, and the way Windows ô handles them. I learn something new everyday.
Iím most happy if any of my comments spark any additional thoughts for you. Please do keep us posted on what you find out. I think being able to add gamepads and/or joysticks to our projects would be cool. Itís a add-on or plug-in that Iíd pay for. Of course, any use that Iíd have for a joystick, would seem rather bohemian next to what you are building.
I like bohemians especially in rhapsodisiatic tunes...
Seriously, I really admire and respect the game engines and gaming software. If I see what "anemic GUI" our psychologist offer to patients in contrast to richness and interactivity levels of modern games I feel well... a bit ashamed. Most of the systems we use in our neurocognitive labs are rather "flat" compared to modern distributed gaming. When one observes the interactive action and complexity that kids handle in SOF or other action games in LAN parties one cannot but admire the technology and engineering "tour de forvce" behind all this. Of course there are more customers (and more money involved) in gaming then in health providing services but then again with a bit more fantasy from the part of our governemental organisations (unless government and fanasy are boolean false) we should be able to work up to that level. Unfortunately this is far from being the case today. Of course there are growing initiatives (fi in the field of virtual reality and simulation software) but at the level of the individual phycician or therapist this is still very expensive and really out of reach. Lured by some racing games I have been looking into these gaming engines in order to create a driving simulator not only for evaluation of driving ability but especially to provide older people with meaningfull and risk free training. There was once an ATARI system like that. Now oblivious. Only some compagnies offer script driven engines (as far as I know) There are some commercial initiatives (fi STISIM-- very good BTW) http://www.systemstech.com/stidrsm1.htm
on the market but they are all to expensive for me.
Therefore I will try to use AMS5.0 Pro to construct a "poor mans drive simulator" (positive side effects: it keeps us young and brain-awake!!).