Delay system
Each event, for each object, has its own predefined delay. For example, calling the key.press('BTN') method does not actually end immediately. Inside there is a built-in delay pressDelay, which is called immediately after the event is called. That is, the internal structure of key.press('BTN') looks like this:
press('KEY');
sleep(pressDelay);
The delay always occurs after the main event is called. Thus, the event occurs almost immediately after the method is called.
The default delay is set to 10ms.. The injecting a delay inside the method allows you to not worry about adding the delay after each event manually. This delay can be set by the method with the prefix set, which allows you to flexibly configure the script and do not worry that the script can suddenly freeze because of too many events per second. Also, for each of the delays, there are methods for obtaining them with the prefix get and resetting the delays to the standard value with the prefix reset. The following is a complete list of methods for working with delays.
// key
// press
key.setPressDelay(pressDelay);
key.getPressDelay();
// release
key.setReleaseDelay(releaseDelay);
key.getReleaseDelay();
// reset
key.resetDelays();
// mouse
// press
mouse.setPressDelay(pressDelay);
mouse.getPressDelay();
// release
mouse.setReleaseDelay(releaseDelay);
mouse.getReleaseDelay();
// wheel
mouse.setWheelDelay(wheelDelay);
mouse.getWheelDelay();
// move
mouse.setMoveDelay(moveDelay);
mouse.getMoveDelay();
// reset
mouse.resetDelays();