PDA

View Full Version : The Message



peter
25-03-2014, 20:10
Hi Eros,

There is weird message, if I write the following strip: " If Key(%VK_C) Then SetData ".
ThinBasic tells me the following story: " If without Then "

Actually is Key(%VK_C) True or False, I think.

Is this error message correct and I am too silly for coding ?

ErosOlmi
25-03-2014, 22:44
Ciao Peter

here all is working fine under thinBasic version 1.9.12.0.
With what version of thinBasic di you get that message?
I tested with this script

Function SetData() As Long
MsgBox 0, Function_Name
End Function

Function Key(ByVal a As Long) As Long
MsgBox 0, Function_Name
Function = %TRUE
End Function

If Key(%VK_C) Then SetData


Maybe there is some other problem and thinBasic error is a false positive of something else.
Can you provide a working example so I can replicate the problem?

Thanks a lot
Eros

peter
25-03-2014, 23:14
Hi Eros,

In the version is 1.9.12 ! I think was the latest beta.
You can reproduce the error with the game, what I had sent.


If Ok=1 Then
DrawText(240,300,"ONCE AGAIN?",&HFFFFFF)
DrawText(240,334,"HIT (c) KEY",&HFFFFFF)
If Key(%VK_C) Then
SetData
End If
End If


The error appeared with this construction:
If Key(%VK_C) Then SetData

peter
25-03-2014, 23:29
Here is it!

After pressing the c-key, I got this.

ErosOlmi
26-03-2014, 00:02
grrr, I'm not able to replicate.

Can you please check thinCore.dll version if it is really 1.9.12?
You can do this going into thinAir and using menu Help\About\ and than checking "File Info" Tab

ErosOlmi
26-03-2014, 00:06
Here is it!

After pressing the c-key, I got this.

OK, thanks, I got the same error.
Now I need some time to find the reason and fix it.

Thanks a lot
Eros

ErosOlmi
30-03-2014, 12:43
For the moment I was able to get that:

this is not working

If Ok=1 Then
DrawText(240,300,"ONCE AGAIN?",&HFFFFFF)
DrawText(240,334,"HIT (c) KEY",&HFFFFFF)
If Key(%VK_C) Then SetData
End If

While just adding () seems working:

If Ok=1 Then
DrawText(240,300,"ONCE AGAIN?",&HFFFFFF)
DrawText(240,334,"HIT (c) KEY",&HFFFFFF)
If Key(%VK_C) Then SetData()
End If



I'm trying to understand why