Home AMX User Forum NetLinx Studio

A Statment doesn't execute

DEFINE_CALL 'MARANTZON'	
{
  IF(!DVDPWR)
  {
    ON[DVDPWR]
    DVDACTIVE = DVDPWR  [color=red][B]//this one isn't executed... why??[/B][/color]
    PULSE[DVD_MARANTZ,DVDPower]
    CALL 'TACTON'
    CALL 'TACT_MARANTZ'
    CALL 'PLASMAON'
    CALL 'PLASMA_MARANTZ'
  }
}

both DVDACTIVE and DVDPWR are integers

Thanks

Comments

  • NMarkRobertsNMarkRoberts Posts: 455
    Works for me

    This code compiled to NetLinx works fine for me:
    program_name='Fred'
    
    define_variable
    
    DVDACTIVE
    DVDPWR
    
    DEFINE_CALL 'MARANTZON'	
    {
      IF(!DVDPWR)
      {
        ON[DVDPWR]
        DVDACTIVE = DVDPWR  //this one isn't executed... why??
      }
    }
    
    define_program
    
    wait 20
      {
    	DVDPWR = 0
    	DVDACTIVE = 0
      call 'MARANTZON'
    
      send_string 0,"itoa(DVDACTIVE),'|',itoa(DVDPWR)"
    	}
    
  • SensivaSensiva Posts: 211
    I Call it in a button_event

    You did the same thing, except i call this routine in button_events, so... why??
  • DHawthorneDHawthorne Posts: 4,584
    I've always tried not to ues ON and OFF for variables - they work, but not knowing exactly how the comnpiler handles them, I'd rather be explicit ... and it's easier to understand the code, too. Have you tried it by replaceing ON[DVDPWR] with DVDPWR = 1? You could even get that whole sequence in one line: DVDACTIVE = DVDPWR = 1.
  • SensivaSensiva Posts: 211
    Mmmm!!

    Well, I tried what you said before posting this thread... but no use, actually DVDPWR is fine but I have noticed that DVDPWR is the only variable that responds in this routine, I have tried to handle DVDACTIVE in another call but no use too, Now I did what I need to keep tracking of the DVD activities, but the question is WHY??... is it somthing in the compiler, or some rule I should follow while I am inside the routine?
  • ericmedleyericmedley Posts: 4,177
    Sensiva wrote:
    Well, I tried what you said before posting this thread... but no use, actually DVDPWR is fine but I have noticed that DVDPWR is the only variable that responds in this routine, I have tried to handle DVDACTIVE in another call but no use too, Now I did what I need to keep tracking of the DVD activities, but the question is WHY??... is it somthing in the compiler, or some rule I should follow while I am inside the routine?

    You might check the other calls you have in the function. Perhaps you're resetting DVDPWR in them by mistake. Or, somewhere else in the program you're resetting the variable... Just a thought.

    happy debugging! :)

    a Steven Wright-ism paraphrased into programming-speak, "Do you ever notice that the mistake you made in the program is always in the last place you look to find it?"
  • rfmoylerfmoyle Posts: 12
    scope problem?

    Well, this probably isn't it, but it's worth a mention. I just added an integer called goofy1 under DEFINE VARIABLE in one of my .axs files and also as a local integer within the push: of a button event in the same file. Compiles without error or warning.

    So is it possible you have done something like this , and are setting the global but checking the local?

    just a thought...

    Bob Moyle
  • SensivaSensiva Posts: 211
    Nope

    these two varibales are global variables.. defined in the define_variable section, and for the idea of resetting them again by mistake , this is not true for three reasons
    1- if it is reset by mistake, i would see it in the watch window.
    2- this variable isn't included in any other calls
    3- i defined another variable called deb_var to replace the DVDACTIVE.. but its still there.

    may be it is because the INTEGER Keyword??
Sign In or Register to comment.