Here is a model that changes the Availability state. If the Staff member is chatting with 1 or more people, they go into the Acquired state. If they are chatting with zero people, they go back to Available.
MultiChat.fsm
The basic idea is that I push all the chat staff onto a list multiple times. Then, patients just try to acquire a staff member by pulling from a list. Then, when they are finished chatting, they release the staff member by pushing them back on the list.
I also added a TrackedVariable label to the ChatStaff, called Patient count. Patients increment that label when they acquire the staff, and decrement it when they release.
Finally, each staff member has a token that listens to the PatientCount label. If it increases to 1 or above, that token changes the state to Acquired. If it decreases to zero, the state changes to zero.
I didn't use standard People objects. It works in this situation, but it may not play nice with the other features of People module, if other objects can acquire or release the chatting staff.
.
Jordan Johnson
Principal Software Engineer
>