Jump to content

help programming .lua for my TsSimComms 1.0.3


Recommended Posts

Posted

Work program tssimcomms

I have a problem with the programming. Lua!

 

 

I have to extract the frequency of BS, but I have a programming problem.

How can I extract the correct frequency?

 

This is the code I use:

 

local R_800 = GetDevice(devices.R_800)
local radio = R_800:l_get_state()
local radionoff = R_800:l_get_state()

   if R_800 then
          radio = canaleradio(radio["frequency"])

   if (radionoff["isOn"] == true) then
    socket.try(c:send(string.format("ON = %.2f", radio)))
   else
    socket.try(c:send(string.format("OFF")))
   end
   end 

 

The problem is that changing the frequency value is not correct !

 

Exemple 127,400 back to me 127 399 why?

 

How can I avoid the error?

sorry my eng traslated by google

====VIAF====

Spinter 155° "Pantere Nere"

 

TsSimComms

 

My Site aiupgrade.net

 

 

 

Posted

Hmm, looks like rounding problem... Considering that frequency changing with 0,025 MHz step you can place instead of something like "if value = 127.400 then ..." with "if value < 127.420 and value > 127.380 then ..." in your program.

WBR, =FV=BlackDragon.

logo3435.gif[sIGPIC][/sIGPIC]

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...