Commands:Sub

The sub command is one of the most useful features in UBot. A sub is like a self contained script within a script. It helps to create cleaner and more maintainable code. When you have a sub in your script, it will not run until you call it using the run sub command.



Besides cleaner scripting and easier organization, it allows you to create an independent script that can be called by any other portion of the bot. Again -- if you have a single bot that contains multiple scripts, any one of the scripts can call a sub routine that is in any of the other scripts. This allows you to, for example, create a separate script for each section of a keyword research tool, and then combine them all in a single script by calling each of the subs in the appropriate order.

To use the sub command, first choose “sub” in the flow command menu. Name your sub routine. Once the sub exists, you can either drag and drop previous script elements into the blank node inside the sub, or you can begin a new section of script there.

Tip Subs will not run until you call one using the run sub command.

Anything contained within the “sub” command won’t occur on its own; rather, it must be called by the “run sub” command. Once a sub has been created, it will not run until you tell it to with this command. This command simply allows you to choose the sub you wish to run. In the below example, the sub routine “Save Account” will not occur until after the create account command, because only then is the sub run command executed.