tarrant wrote:
This is in an alias.
This sums up the reason for your error. Your function stbfire() will only be created when you use the alias tbfire.
So when your function autoBuyAmmo() wants to call stbfire() before you have executed the alias tbfire once, it will produce an error, since the function stbfire() doesn't exist yet.
This is why it's uncommon to define functions in aliases. You usually define functions in script files under the "Scripts" tab. These files/items are run when you connect to your profile, so if you define your functions within those you can be sure they will be defined during runtime. You can (and should) -call- functions from within aliases, of course.
As for combining those functions into a single one:
I'd need to see how exactly they differ, so you should post at least a second one (stbearth or whatever). But my saying that it might be worth to combine them was just a wild guess. It may very well be that your functions work in a way where separate functions are the much better solution.
I'd say the top priority right now is getting it to work. Worrying about "good coding practices", efficiency and style can be postponed a bit, I guess