The self-sorting processes in dynamic libraries of cucurbit[8]uril complexes can be switched in an orthogonal way by external stimuli. Protonated phenylpyridine guests form a 2:1 homoternary pi-donor-pi-acceptor complex, while deprotonation makes it a partner for ethylviologen in a 1:1:1 heteroternary complex. Reduction of the viologen instead generates 2:1 homoternary complexes of viologen radical-cation.