Or maybe:
if (local.weapon[8] == ".")
local.action = local.weapon[7]
else
local.action = string local.weapon[7] + local.weapon[8]
local.player exec mom/mom_actions.scr local.action
local.player holster
?
No loop, no switch, just that. Not seen the code so don't know how weapon is generated, so could it be made better by not passing the whole string in the first place? It would be more readable if you didn't I guess.
An even smaller variation you could have, because the int cast will ignore the "." char (as it's after the integer), is:
local.action = string local.weapon[7] + local.weapon[8]
local.player exec mom/mom_actions.scr (int local.action)
local.player holster
So no conditional statements needed. Implicit casting will take care of the int in the mom_actions script so no change needed that end. This isn't an issue, but you also don't need to include the method, as main will be read automatically (personally I don't include it as I find it less cluttered and more readable without).
Oh, and obviously even smaller than that is:
local.player exec mom/mom_actions.scr (int (string local.weapon[7] + local.weapon[8]))
local.player holster
You get the idea. Fewer lines isn't always the best, but I think it's still pretty readable.
LOL:
local.player exec mom/mom_actions.scr (int (string local.weapon[7] + local.weapon[8])); local.player holster
OK, I'll stop...