Jump to content
UBot Underground

understanding defines : for noobs


Recommended Posts

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_account

load_in_proxy

test_proxy_account_working

login_to_youtube

upload_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.

Link to post
Share on other sites

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.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...