Home AMX User Forum AMX General Discussion

Waits problem

I have been using a stack var to allow me to select one of my 6 identical devices, allowing me to use the same transport buttons, but i now need to send muliple commands to one of the devices, i need to utilise the stack var if poosible as otherwise i will need to revisit all the previous code, obviously waits are not allowed when using stack variables as shown below
BUTTON_EVENT[VIEW_209_TP,9] // playback last recording
{
PUSH:
{
STACK_VAR INTEGER F
F = GET_LAST(SELECT_PANEL6_DVR)
SEND_STRING PANEL_6[F], "'@00:DR:FP:32:N:*'"
wait 05
{
SEND_STRING PANEL_6[F], "'@00:DR:MN:*'" //MENU
WAIT 03
{
SEND_STRING PANEL_6[F], "'@00:DR:DN:*'" //DOWN
WAIT 02
{
SEND_STRING PANEL_6[F], "'@00:DR:DN:*'" //DOWN
WAIT 02
{
SEND_STRING PANEL_6[F], "'@00:DR:RI:*'" //RIGHT
WAIT 03
{
SEND_STRING PANEL_6[F], "'@00:DR:DN:*'" //DOWN
WAIT 03
{
SEND_STRING PANEL_6[F], "'@00:DR:DN:*'" //DOWN
WAIT 03
{
SEND_STRING PANEL_6[F], "'@00:DR:EN:*'" //ENTER
}
}
}
}
}
}
}
}
}


Any help in this matter would be greatly appreciated.

Thanks

Comments

  • DiogoDiogo Posts: 65
    Try using LOCAL_VAR instead of STACK_VAR

    The stack_var is deallocate from the memory right after the end of the event, in this case, the push.
    With Local_var variables, the processor will maintain in memory for later use.

    You can have more details in the netlinx keywords help

    Regards,
  • ericmedleyericmedley Posts: 4,177
    This is a great example of a time to use a timeline.
  • the8thstthe8thst Posts: 470
    ericmedley wrote: »
    This is a great example of a time to use a timeline.

    The structure item timeline.id will be very useful in this instance as well.
  • DHawthorneDHawthorne Posts: 4,584
    Yeah, nesting waits like that is a bit more then ugly, and a timeline will clean it up nicely. Even using a LOCAL_VAR could have issues, because if some button-happy user starts mashing buttons, it's possible for the local to get changed before previous waits have timed out, and the it will wind up going to the wrong device. A timeline can be cancelled.

    But I have to wonder if the waits are necessary in the first place. What kind of device is this? I think you might benefit more from creating a buffer so you can send them all at once, and let your buffer handler pace the execution.
  • svTechsvTech Posts: 44
    Put the individual messages on a Que and pull them off one by one, using either a wait or a timeline. If you populate the msg when the wait (or even timeline depending on the logic around the timeline), the variable can change based on other programming logic. But if you create all of the msgs at once, storing them on a queue at that time, then you know the statements will be accurate.
  • a_riot42a_riot42 Posts: 1,624
    I don't think it has anything to do with the waits. You can't send smileys to devices.
    Paul
  • a_riot42 wrote: »
    I don't think it has anything to do with the waits. You can't send smileys to devices.
    Paul

    Now's a good time to mention putting code samples in [ code ] CODE [ /code ] (no spaces) tags will format everything correctly and not produce smileys... ;)


    That said, does button 10 get you 30 men when playing two player? ;)

    Kevin D.
Sign In or Register to comment.