the_way 52 Posted May 11, 2014 Report Share Posted May 11, 2014 If you're a new user to ubot, and you've been building programs, and yet to master defines, here is a simple method for learning. When you are creating a program,think about the parts that you need to complete separately. These are functions and will perform a specific task contained within that function. As an example if you are writing a program for a youtube video uploader, you could have the following defines. load_in_youtube_accountload_in_proxytest_proxy_account_workinglogin_to_youtubeupload_video You would create these defines and this is called the FUNCTIONS of the program. You can test them to make sure they work perfectly. Then, depending on what you want to then do in terms of the operations, you next build the FUNCTIONALITY. >loop while load_in_youtube_account load_in_proxy>IF test_proxy_account_working >THEN login_to_youtube upload_video>ELSE stop script As you can see, its much easier to create the functionality around the functions. Quote Link to post Share on other sites
UBotDev 276 Posted May 11, 2014 Report Share Posted May 11, 2014 You didn't but I think you should mention the main benefit, which is reusable code. Defines should be written the way that you can re-use them by passing in different data (for example "load_in_proxy('192.168.1.1')"). Defines are also handy for error handling, since you can abort the execution of the command/function with "return" command (without adding if statements all over the code). Btw, beside FUNCTIONS in UBot we also have COMMANDS, the difference is that first return a value, but second don't. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.