This is what I meant by not being able to put a Positive Transition Contact:
U can only put a direct contact. If 'var1' tag would be placed on HMI as monostable button it would be impossible to perform operation that needs single trigger e.g : incrementation, toggling.
Meanwhile, I came up with a different approach that omit using UDFB:
I will create 20 subroutines, however each of them will be separated to 3 regions.
subroutine1:
Region 1 - copy struct1 to structX
Region2 - program based on variablesX
Region3 - copy structX to struct1
subroutine2:
Region 1 - copy struct2 to structX
Region2 - program based on variablesX
Region3 - copy structX to struct2
...
This way I do not have to put variables of each room to every basic element(every contacts and so on). Whenever I need to change something in program, I copy Region2 to every subroutine and change structs if needed.
There is one flaw in this idea, I cant copy e.g Timer1 to TimerX, Timer2 to TimerX ... because it will not work, so in Region2 of each subroutine I need to put correct timer variable(Timer2). I cannot leave TimerX. Anyway, its better than changing all the basic elements.
Do you have any other ideas?