Non-hard-coded object reference?

I have a script that checks if a condition is true, then performs an action, which is move a cube (performed in a script attached to the object moved, the detecting is attached to the object that is the conditional). If I attach the movement script to another object, though, it moves both objects. What can I do (without hard-coding, as there will be hundreds of these events and we don’t want hundreds of scripts with only different variables) to pick which gameObject to use like I can with variables in the object components?

use ‘name’ or gameObject.name etc.

Figured it out - declaration should be var varName : GameObject;