Well, the code for setting the screen width and height variables, and the ratio variables is this:
int screenwidth = int((2*(screen.width))/3), screenheight = int((3*(screen.width))/8);
float xratio = screenwidth/960, yratio = screenheight/540;
Then, in the setup() function, I call
size(screenwidth,screenheight);
Then, for anything that needs to be drawn to the screen, I make the sizes fit on my computer screen, and the window is 960x540, and then multiply it by the ratios (so, for example, on my screen the ratios are both one, so they do nothing, but on another screen, it should account for the difference):
rect(50*xratio, 50*yratio, 200*xratio, 50*xratio);
For using scale(), I simply commented out (put "//" at the beginning of the line) the "float xratio..." line, and put beneath it, "int xratio = 1, yratio = 1," so as not to mess with the rest of the code, and then added the following line to the beginning of the draw() function:
scale(screenwidth/960,screenheight/540);