Jump to content
UBot Underground

How To Seperate My Code?


Recommended Posts

Right now I have like 200 lines of code in my bot. It's all piled into one main script.

 

What I want to know is how to seperate my code.. like for example, instead of:

 

----

Comment: Part1 - Scrape

Set

Loop

Scrape

Add to List

 

Comment: Part 2 - Send

Set

Loop

Send

 

Comment: Part 3 - Verify

Loop

Navigate

Search For Text

 

etc etc

----

 

What I'd much rather have is my main script look like this:

 

----

Comment: Part1 - Scrape

Include Scrape

 

Comment: Part 2 - Send

Include Send

 

Comment: Part 3 - Verify

Include Verify

----

 

Then I can edit each of those 'includes' its own tab or its own .ubot file.

 

Is this possible in ubot? I need a better way to seperate and clean up my code.

Link to post
Share on other sites

subroutines, by adding tabs.  or adding ui buttons which will act as subroutines.  If you use the ui button method then each button would have to be pressed in order for the fucntion to be carried out.

Link to post
Share on other sites

@innerged - thanks for the response! the only problem is I still want the entire script to run on its own with just one press of the play button

 

@a2mateit - is it possible to create a define command in tab 2 then call it in tab 1?

Link to post
Share on other sites

In the old version (V3) you could use includes but in V4 / V5 the best way I have found is to use defines and store them in a text file so you can use them for future projetcs. When I create a big bot I have a separate tab which I use for generic code, another for bot specific code etc. This way it keeps everything manageable.

Link to post
Share on other sites

Try this one :

 

Tab1 (Main Tab):

UI Button("Execute") {

Command1()

Command2()

Command3()

}

 

Tab2:

define Command1 {

comment("list of commands here")

}

 

Tab3:

define Command2 {

comment("list of commands here")

}

 

Tab4:

define Command3 {

comment("list of commands here")

}

Link to post
Share on other sites

You guys are great, thanks for the help!

 

i use:

 

onload

---------

define 1

define 2

define 3

...

---------

main loop

--------

ui stat 1

ui stat 2

 

Never used that on load command before, very useful, thx!

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