To do that you just need to pick the other block to swap with. This is where the family comes in so you can pick two separate instances of the block. Basically create a family, call it "other" and add the block type to it. So for example if you wanted the block you click on to swap with the block to the right you could do this:
global number tempx=0
global number tempy=0
on right clicked on block
other: x = block,x+32
other: y = block.y
--- set tempx to block.x
--- set tempy to block.y
--- block: set position to (other.x, other.y)
--- other: set position to (tempx, tempy)