Interesting bug. Somehow, questionStartTime has a bigger value than questionEndTime. If you find a way to reproduce the bug always, I can look into it.passingby wrote:I'm just a really big fan of the project. I'm glad my input helped.
Speaking of...
I ran into this weird bug with the timer:
[spoiler][/spoiler]
No there isn't, but you could easily code a reset functionality. I can help you into start (as my code isn't that clear) and you may release it with your name (I don't mind at all). For reseting the timer, I suggest to do it within waitPress function ( search waitPress = function() ). Then search "local pad = Controls.readPeek()". See this:passingby wrote: Kind of related,
Is there any way to reset the course timer besides starting a different course, then going back to the one you want to start again?
Or a way to restart it when you start from a new break point?
if (pad:cross() or pad:triangle() or pad:circle() or pad:square()) then
screen.waitVblankStart(20);
break;
Let's modify this line by triggering the reset functionality when user press triangle. In this case, we do this:
#############################################
if (pad:cross() or pad:circle() or pad:square()) then
screen.waitVblankStart(20);
break;
elseif (pad:triangle()) then
-- clearing timer related variables (questionTotalTime is the most important as it's a global variable).
questionTime = 0;
answerAverage = 0;
estimationTime = 0;
questionTotalTime = {0, 0};
screen.waitVblankStart(20);
#############################################
I see you shortened the right.png's. You might also want to add a feature to hide right.png and timer. If we only do this locally, we could
#############################################
waitPress = function()
local showTimerAndAnswer = true -- don't add key word local if you want the setting to be global.
-- some code in between
if (waitTimerAndAnswer) then
if (question == first) then
screen:blit(60, 116, right);
elseif (question == second) then
screen:blit(60, 146, right);
elseif (question == third) then
screen:blit(60, 176, right);
else
screen:blit(60, 206, right);
end
end
-- some code in between
if (waitTimerAndAnswer) then
ifontLtn:setStyle(0.6, lime, darkgray, IntraFont.ALIGN_LEFT);
ifontLtn:print(107, 100, "Answering time: " .. round(questionTime) .. " / Average: " .. round(answerAverage) );
ifontLtn:print(107, 115, "Total time: " .. round(questionTotalTime[1]) .. " / Estimation left: " .. round(estimationTime));
end
-- then when use another key to change the variable waitTimerAndAswer, for example:
-- some code before
elseif (pad:circle()) then
if (waitTimerAndAsnwer) then
waitTimerAndAnwser = false;
else
waitTimerAndAnswer = true;
end
screen.waitVblankStart(20);
-- some code after
#############################################
Note, may not "compile" as is, but you should get the main idea.
Advertising