Home AMX Forum AMX General Discussion
Options

Coding question

Dose anyone know if <ctrl-E> <ctrl-E><x30><0d>, can be entered into code and work or does the AMX see the <ctrl-E> as an ENQ ?

Comments

  • NMarkRobertsNMarkRoberts Junior Member
    Does anyone know if <ctrl-E> <ctrl-E><x30><0d>, can be entered into code and work or does the AMX see the <ctrl-E> as an ENQ ?

    Assuming that you are referring to NS2 compiling NetLinx code:

    You can put anything you like in a CHAR.

    There would be no purpose in putting such a character anywhere else in the code.

    This code compiles fine:
    PROGRAM_NAME='Sandpit'
    define_variable
    char a[100] 
    define_start
    a = "$05,$05,$30,$0D"
    

    I note however that the following code does not compile, which appears to be a compiler bug:
    PROGRAM_NAME='Sandpit'
    define_variable
    char a[100] = "$05,$05,$30,$0D"
    

    I get "RHS is not a constant" when defining a variable with an initial value which is a string surrounded by double quotes. It compiles OK for a define_constant and the contents of the string have no bearing on it.
  • mpullinmpullin Obvious Troll Account, Marked for Deletion
    PROGRAM_NAME='Sandpit'
    define_variable
    char a[100] = "$05,$05,$30,$0D"
    
    Can't do this, it's got to be:
    char a[100] = {$05,$05,$30,$0D}
    
  • NMarkRobertsNMarkRoberts Junior Member
    mpullin wrote:
    Can't do this, it's got to be:
    char a[100] = {$05,$05,$30,$0D}
    

    Accepting that is the rule, I observe that double quotes seem to work OK in every other comparable situation, which is a trap for young (and old) players.
  • Thomas HayesThomas Hayes Junior Member
    Thanks for the info. I tried a <ctrl e> directly on the command line and it gives a 'ENQ' as the result for pressing these keys. I had already tried the 05,05,30,0d but was unable to get the expected result from the device. For now I just did it the old fashion way with a counter and do_push to toggle the device between its logic states.
Sign In or Register to comment.