[Defconapi] Lua API GetDistance() Not Working?

Geoff Cox Geoff.Cox at ihealthtechnologies.com
Tue Feb 16 09:29:55 CST 2010


Hello, this is my first post to the mailing list, perhaps there are people 
still reading this...

I am not familiar with code, however, I'm working my way towards building 
a bot using the Lua API. Another IV forum member roflamingo is as well and 
came across a possible problem. ?

GetDistance() produces some strange results:

See this thread: 
http://forums.introversion.co.uk/defcon/viewtopic.php?t=7200

[code]
        SendChat(GetGameTick() / 10 .. " seconds") 
        SendChat(GetDistance (siLos[1]:GetLongitude(), 
siLos[1]:GetLatitude(), siLos[2]:GetLongitude(), siLos[2]:GetLatitude()))
        SendChat(GetDistance (siLos[1]:GetLongitude(), 
siLos[1]:GetLatitude(), siLos[1]:GetLongitude(), siLos[1]:GetLatitude()))
        SendChat(GetDistance ( -0.166700, 51.500000,  -74.000000, 
40.750000) .. " London to New York")
        WhiteboardDraw(-0.166700, 51.500000,  -74.000000, 40.750000)
        WhiteboardDraw(siLos[1]:GetLongitude(), siLos[1]:GetLatitude(), 
siLos[2]:GetLongitude(), siLos[2]:GetLatitude())
        WhiteboardDraw(siLos[1]:GetLongitude(), siLos[1]:GetLatitude(), 
siLos[1]:GetLongitude(), siLos[1]:GetLatitude())
[/code]


Produces: 

141.44581604004 (silo 1 and 2, placed right next to each other)
144.99998474121 (silo 1 to silo 1) Shouldn't this be zero?
145.60768127441 (London to New York)

Thank you.

Ace.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.introversion.co.uk/pipermail/defconapi/attachments/20100216/02082951/attachment.htm 


More information about the Defconapi mailing list