Home AMX User Forum NetLinx Studio

Newb needing help with Syntax.

Yes I am on the uphill side of the learning curve with my programming skills, though I have been pretty sucessful on my current project so far.

Can someone take a look at the syntax of the following string and tell me what the error is? I am controlling an Extron Crosspoint 300 with an NI-3100. I have sucessfully made the switcher switch already, but this time I have created a "Switcher page" on my panel and I need to fill in the string with input and output numbers from the panel:
send _string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput)'!'"
When I complie this in NetLinx Studio I get C10201: Syntax error

A more straightforward string looks like this:
send _string dvSwitcher, "'2*1!'" (tells the switcher to set input 2 to output 1)

I really have been looking for a resource for the specifics in netlinx syntax, especially relating to strings.
I just can't wrap my head around what each bit of syntax does, which would help me remember it better.

Anyway, can anyone tell me the (hopefully) obvious error that I'm missing!

Thanks!

Comments

  • AMXJeffAMXJeff Posts: 450
    send _string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput)'!'"
    
    send _string dvSwitcher, "'2*1!'" (tells the switcher to set input 2 to output 1)
    

    // looks like you have a space between your "send" and your "_string". plus you need one more comma before the string literal '!' and the end...
    send_string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput),'!'"
    
    send_string dvSwitcher, "'2*1!'" (tells the switcher to set input 2 to output 1)
    
  • Joe HebertJoe Hebert Posts: 2,159
    send _string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput)'!'"
    
    When I complie this in NetLinx Studio I get C10201: Syntax error
    You are missing a comma after itoa(nOutput). Try this:
    send _string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput),'!'"
  • Jimweir192Jimweir192 Posts: 502
    Think you will need an extra comma before then final byte - '!'

    send_string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput)'!'"
    send_string dvSwitcher, "itoa(nInputVGA),'*',itoa(nOutput),'!'"

    Edit - sorry for the duplication!!
  • Thanks guys.

    So, ok, how did you know that, and why does it work?

    Do you just know because it is that way, or you just memorized it from doing it so many times, or is there a logical reason it needed to be that way?

    Still learning learning learning.
  • Spire_JeffSpire_Jeff Posts: 1,917
    The send _string thing might show up as a different color than expected in NS2, but this depends on the color settings you have used. The color change can be very obvious after coding for a while.

    As for the , issue....it helps to think of the , as + for character strings. It has to appear between all of the elements within ".

    Jeff
  • DHawthorneDHawthorne Posts: 4,584
    In NetLinx, the comma is the concatenation operator for strings. So, all of the elements of your string (everything within the "") must be separated by this operator. Other languages use a +, but there needs to be something in there that tells the compiler, "I am building a string with these parts." There is no implied operator if it is missing anywhere.
  • Ah HA!

    The light bulb goes on!
Sign In or Register to comment.