Quote: "After exhaustive measures it appears that the compiler is at fault."
I have to disagree. Each command and variable in your program is working as it should. The reason your program appears to not work is because the 'wait key' only works for 1 iteration and it doesn't check for you to let go of the key you are pressing.
So you press a key, the wait key disappears in an instant, computers work very quickly, while that key is still being pressed, your loop is entered. A thousand iterations (loops) could occur in the time that the wait key disappears and you letting go of the key.
Small example
count as integer = 0
do
print inkey$()
if inkey$()<>""
count = count + 1
endif
if inkey$()=""
cls
print count
endif
loop
How many times do you think the inkey$ command will have detected the key that you have pressed?
If you take out both of the wait key commands in your program you will find that the mouseclick command works the way you want it to.
If you want to keep the wait key command before your loop then I suggest utilizing a boolean. Here is an example:
allow_inkey as boolean = 0
Print "Hello World!" : Wait Key
For X=50 to 2 step -1 : Print X : Next X
print "1";
Repeat
if inkey$()="" then allow_inkey = 1
AskM=MouseClick()
cls
print "Loop has started"
if allow_inkey = 1
AskK$=Inkey$()
endif
Until AskK$>"" or AskM>0
print "Loop has ended"
wait key
I hope this clears things up a bit.
A clever person solves a problem, a wise person avoids it - Albert Einstein