maybe something with waiting before returning the value?
yes, that is the reason. You can't return a value when there is a wait inside the function. You might pass a pointer as parameter of the function.
function get_keyType(var* _keyType) {
var _startTime = 0;
while (mouse_left) {
if (total_ticks - _startTime > 8) { // 8 ticks == 0.5 seconds
*_keyType = KEYTYPE_HOLD;
break;
}
wait(1);
}
}
...
get_keyType(&_keyType);
Salud!