edg3
11-10-2007, 07:35 PM
I have a question not exactly to do with game development (it is a game of sorts, but more of an IT project).
the loops we have to use are as follows:
repeat
inc(iCount,5);
redOut.lines.add(inttostr(iCount));
sleep(100);
{ insert the line/lines to interrupt here
application.processmessages; doesnt work }
until (iCount = iMax);
while (iCount < iMax) begin
inc(iCount,5);
redOut.lines.add(inttostr(iCount));
sleep(100);
{ insert the line/lines to interrupt here
and app.processmsgs doesnt work here either }
end;
We need to be able to end the loop or at least make note of where the person tried to stop it (eg when iCount is 45) and then work out certain things afterwards. The only issue I have is that not even our IT teacher can give us a solution to this problem!
We tried looking for a solution, and came up with using this:
application.processmessages;
but unfortunately it only runs the event I try to run (eg if I click on the stop button) after the loop ends, when its too late to work out where/when they clicked it.
The program/"game" is to try be a challenge for people to choose a number, and try stop on the number they chose. Its simple enough to do with a timer, but we have been specifically told to use loops.
the loops we have to use are as follows:
repeat
inc(iCount,5);
redOut.lines.add(inttostr(iCount));
sleep(100);
{ insert the line/lines to interrupt here
application.processmessages; doesnt work }
until (iCount = iMax);
while (iCount < iMax) begin
inc(iCount,5);
redOut.lines.add(inttostr(iCount));
sleep(100);
{ insert the line/lines to interrupt here
and app.processmsgs doesnt work here either }
end;
We need to be able to end the loop or at least make note of where the person tried to stop it (eg when iCount is 45) and then work out certain things afterwards. The only issue I have is that not even our IT teacher can give us a solution to this problem!
We tried looking for a solution, and came up with using this:
application.processmessages;
but unfortunately it only runs the event I try to run (eg if I click on the stop button) after the loop ends, when its too late to work out where/when they clicked it.
The program/"game" is to try be a challenge for people to choose a number, and try stop on the number they chose. Its simple enough to do with a timer, but we have been specifically told to use loops.