|
Post by tbird on Nov 12, 2019 22:18:38 GMT -6
Hey n00b I am not entirely sure what this means but I keep getting an error with this code: "Error on Line 33 in bug_test_001.bas: Expected identifier of same type in assignment"
This works fine in 3.10, is there something in the new version that requires variable definition now?
Function Atan2(a, b)
radian = 0 pi = 3.14159
if b > 0 then radian = atan(a/b)
elseif b < 0 and a >= 0 then radian = atan(a/b) + pi
elseif b < 0 and a < 0 then radian = atan(a/b) - pi
elseif b = 0 and a > 0 then radian = pi / 2
elseif b = 0 and a < 0 then radian = 0 - (pi / 2 )
elseif b = 0 and a = 0 then radian = 1000 'represents undefined end if
return radian
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Get the degrees
Function GetDirection(mPX, mPY, posX, posY)
pi = 3.14159 radian = atan2((mPY - posY), (mPX - posX)) degrees = radian * 180 / pi
return degrees End Function
|
|
|
Post by johnno56 on Nov 13, 2019 5:50:28 GMT -6
I just tried this on the Linux version of 3.11 and got the same result.
I tinkered with it and found it didn't like 'degrees'. I changed 'degrees' to 'deg' and the problem went away... Not sure if that fixes it or perhaps 'degrees' is a reserved word in the new version? Have no idea...
|
|
|
Post by n00b on Nov 13, 2019 6:53:32 GMT -6
Degrees and Radians are both built-in functions now. I mentioned it in the release notes with all the other changes.
|
|
|
Post by tbird on Nov 13, 2019 8:06:29 GMT -6
Awesome thanks for the clear up, I was in a rush to give it a go and didn't do any reading lol.....well don't I feel silly now.
Next step read release notes before further use....
|
|