Home AMX User Forum AMX General Discussion

What's wrong?

Hello all
Here is a piece of code I can't get to work, I have another piece that works fine but keep getting a 'can not convert 'string' to 'doulbe' Once I quote out the 'SEND_LEVEL VTP, 1, VOL_BAR_REF'

Doesn't work:
SEND_STRING SWT,MLS_AUD_LVL
WAIT 10
{
VOL_BAR_REF=ATOI(MID_STRING(MLS_BUFFER, 5, 2))
SEND_LEVEL VTP, 1, VOL_BAR_REF
}

Works:
CountTimer_C= CountTimer_C+1
BARGRAPH_COOL=COUNTTIMER_C*3
SEND_LEVEL VTP , 4, BARGRAPH_COOL

Comments

  • GSLogicGSLogic Posts: 562
    Here is a piece of code I can't get to work,
    Doesn't work:
    SEND_STRING SWT,MLS_AUD_LVL
    WAIT 10
    {
    VOL_BAR_REF=ATOI(MID_STRING(MLS_BUFFER, 5, 2))
    SEND_LEVEL VTP, 1, VOL_BAR_REF
    }

    Thomas
    You are sending a different variable from the send_string.
    MLS_AUD_LVL
    MLS_BUFFER
  • Thomas HayesThomas Hayes Posts: 1,164
    The send_string code is a request code to the extron MLS-304 for audio level. I'm taking the reponse from the Extron and dumping it to a buffer, removing the level info and converting that using ATOI for the panel. Sorry I didn't post more code since because this was the part that was giving me the error.
  • Thomas HayesThomas Hayes Posts: 1,164
    After a few hrs of playing around I finally got it to work by changing the location of the ATOI
    from:
    SEND_STRING SWT,MLS_AUD_LVL
    WAIT 10
    {
    VOL_BAR_REF=ATOI(MID_STRING(MLS_BUFFER, 5, 2))
    SEND_LEVEL VTP, 1, VOL_BAR_REF
    }

    to:
    SEND_STRING SWT,MLS_AUD_LVL
    WAIT 10
    {
    VOL_BAR_REF=MID_STRING(MLS_BUFFER, 5, 2)
    SEND_LEVEL VTP, 1, ATOI( VOL_BAR_REF)
    }
  • Joe HebertJoe Hebert Posts: 2,159
    I think your original may work if you:

    Change this:
    VOL_BAR_REF=ATOI(MID_STRING(MLS_BUFFER, 5, 2))

    To this:
    VOL_BAR_REF=ATOI("MID_STRING(MLS_BUFFER, 5, 2)")
Sign In or Register to comment.