LW> I'm currently having a play around with MPL scripts (A46 Win32) and
LW> appear to have run into an issue regarding the 'KeyPressed/ReadKey'
LW> functions in the following code:
My first suggestion would be to update to the A47 release since I no longer
have the A46 code to make a fix if we do determine a bug exists. It could be
something fixed in A47 as well.
LW> gExitFlag := false;
LW> repeat
LW> write('|[X00|[Y00' + int2str(gCount));
LW> gCount := gCount + 1;
LW> if (keypressed()) then
LW> begin
LW> if ('q' = readkey()) then
LW> gExitFlag := true;
LW> end
LW> until gExitFlag = true;
Assuming you're not trying to do more than what you're showing here you could
simplify this with a single line like:
Repeat Until OneKey('Q') = 'Q';
Or
Repeat Until UpCase(ReadKey) = 'Q';
In any case, if you are going to loop like you are there I would suggest
putting some minor delay in there so as to not blow up your CPU usage. Maybe a
delay(10) at the bottom of the repeat loop.
... Some people have no idea what they're doing, and are really good at it!
--- Mystic BBS v1.12 A47 2021/12/25 (Windows/64)
* Origin: Sector 7 * Mystic WHQ (1:129/215)
|