You shouldn't need to create a bunch of global variables.
you can create one boolean called "swiped" and then a condition that says:
If swiped = true do X actions
Then you would have:
On button clicked set "swiped" true
and the first action inside your function could be set "swiped" to true
Depending on your needs you could return it to false at the appropriate time