Variable issues

I haven’t seen this done before but I wanted to try and make an easier script for myself.

instead of having button that states a variable then plays an animation, while the animation has a code saying " if ("variable == “number”) {
do something
}
a million times for each possible variable outcome, I wanted to do a script where the number sets a worded variable instead of a number, then have a code on the MC say something like: onClipEvent(enterframe) {
gotoAndStop(“number”)
}

basically the button setting a word as a varible set as “number” which number will be the MC’s frame labels.

How would I set up the button’s code?

Sorry if i’m being too vauge.