A lot of people have already worked this out, but here's my way of doing this:
You don't want the button to flip per frame when you hold the mouse button for multiple frames, what would happen if you would simply use button=getkbmouse(3); I solved this by generating a pulse when the mouse-button is pressed.
This pulse normally would only trigger the button for 1 frame. You want it to switch per pulse. Here's how I solved it all (button is reg02).
Example preset is attached (will most likely be in my new pack).
xm=getkbmouse(1);
ym=getkbmouse(2);
rm=getkbmouse(3);
mc=if(below(xm,-.9)&above(xm,-1)&above(ym,.9)&below(ym,1)&rm,1,0);
mcpulse=if(equal(mcold,mcnew),0,if(equal(mcold,0),1,0));
mcold=var;
var=if(equal(mc,0),mcpulse,1);
mcnew=var;
mcswitch=if(mcpulse,bnot(mcswitch),mcswitch);
reg02=mcswitch;
The button appears when you move the mouse over the left and bottom of the preset ( xpos < -0.9 or ypos < 0.9 ) Click it and the preset changes. Also explained in the comment.