botmaker7 5 Posted November 27, 2013 Report Share Posted November 27, 2013 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 - ScrapeSetLoopScrapeAdd to List Comment: Part 2 - SendSetLoopSend Comment: Part 3 - VerifyLoopNavigateSearch For Text etc etc---- What I'd much rather have is my main script look like this: ----Comment: Part1 - ScrapeInclude Scrape Comment: Part 2 - SendInclude Send Comment: Part 3 - VerifyInclude 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. Quote Link to post Share on other sites
innerged 15 Posted November 27, 2013 Report Share Posted November 27, 2013 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. Quote Link to post Share on other sites
a2mateit 395 Posted November 27, 2013 Report Share Posted November 27, 2013 The define command is what you need. Put each step from Part 1-3 into defines. Then call them in the order you need them. http://wiki.ubotstudio.com/wiki/Define Quote Link to post Share on other sites
botmaker7 5 Posted November 27, 2013 Author Report Share Posted November 27, 2013 @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? Quote Link to post Share on other sites
TheBigWeb 40 Posted November 27, 2013 Report Share Posted November 27, 2013 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. Quote Link to post Share on other sites
a2mateit 395 Posted November 28, 2013 Report Share Posted November 28, 2013 @a2mateit - is it possible to create a define command in tab 2 then call it in tab 1? Yes it is possible. Quote Link to post Share on other sites
the_way 52 Posted November 28, 2013 Report Share Posted November 28, 2013 i use: onload---------define 1define 2define 3...---------main loop--------ui stat 1ui stat 2 Quote Link to post Share on other sites
xenergy 3 Posted November 29, 2013 Report Share Posted November 29, 2013 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")} Quote Link to post Share on other sites
botmaker7 5 Posted November 30, 2013 Author Report Share Posted November 30, 2013 You guys are great, thanks for the help! i use: onload---------define 1define 2define 3...---------main loop--------ui stat 1ui stat 2 Never used that on load command before, very useful, thx! 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.