DEFINE_CALL with parameters
bth
Posts: 1
I have had a very bad experience with the DEFINE_CALL. I was supposing it worked the same as functions in other languages. So when i wrote a define call for rooms that could be combined, i was using a parameter for the room like this:
DEFINE_CALL 'SET_PROJECTOR' ( P_ROOM, P_CMD )
My idea was to use the call for each room with different parameters but till my surprise only the last call was always doing its work. This happened only when i was using waits in the defne call. So i recognised that the last define_call always cancelled all waits of the previous called!!!
Do you know a technology to work it around, let me know.
DEFINE_CALL 'SET_PROJECTOR' ( P_ROOM, P_CMD )
My idea was to use the call for each room with different parameters but till my surprise only the last call was always doing its work. This happened only when i was using waits in the defne call. So i recognised that the last define_call always cancelled all waits of the previous called!!!
Do you know a technology to work it around, let me know.
0
Comments
There weren't any waits being cancelled. When your wait was called, you essentially qued up a block of code, saying "please wait x amount of time before running this code".
Your call was only capable of referencing ONE room variable at a time. Look at this:
CALL 'SET_PROJECTOR' (ROOM_A, VID_IN_CMD)
CALL 'SET_PROJECTOR' (ROOM_B, VID_IN_CMD)
CALL 'SET_PROJECTOR' (ROOM_C, VID_IN_CMD)
If the code in your call for handling the video input command is inside a WAIT statement and references P_ROOM, just think about it a bit - by the time the wait (which is only qued up ONCE when the above three lines of code are run) expires, P_ROOM can/will ONLY be equal to ROOM_C.
I.E., by the time the wait expires, P_ROOM has already gone from being equal to ROOM_A to ROOM_B and finally to the last value it was set to - ROOM_C.
What you >need< is a WAIT with a variable name definition - which we don't have.
One solution is to have a SELECT-ACTIVE block for each possible room value in your call, with a different wait block inside each ACTIVE segment. Inelegant, and kinda goes against part of the reason to have subroutines in the first place, but it would work.
I'm thinking that there is a more elegant solution, but at the moment it's not coming to me...
- Chip
Now this might not be fully functional as I am hungry and I just quickly adapted some code I had to fit your situation, but hopefully this demostrates my point. If you have any further questions, or if something doesn't make sense, feel free to ask me.
Jeff
P.S.
If all of the projectors share a common bus, you could use TIMELINE.SEQUENCE as opposed to the for loop for queue processing (still need to check all projectors with the for loop to decide if the timeline is still needed)
Hope this helps and it makes as much sense in typed form as it does in my head at the moment