If you make the variables that you want to have reset into "local variables" of loop, they will be reset every time that loop runs:
void loop() {
int pip = 1;
:
Of course, variables that you want to be "sticky" between loops should stay global...