mdc101 15 Posted December 1, 2011 Report Share Posted December 1, 2011 Hi FolksI would like to know what the best way to use the define command.I have read through all the threads but would like to tap into the Gurus minds and find out what is the practical real world best practices for using the define command in bots.From what I have figured out it can make the bots pretty light and as it could eliminate duplicate code if the bots routines are planned well. Is it possible to keep all the defined commands in one functions tab? i.e. a tab that holds all set functions and command. Then from other tabs that process tasks call on the commands using the custom command. Are these define commands global and work across all tabs in a bot? Quote Link to post Share on other sites
Eddie 14 Posted December 14, 2011 Report Share Posted December 14, 2011 i think it's a good usage, i don't know if we can use the define command or function as a seperated ubot file, so if we need we can call it, like call javascript file in the html page. does anyone know if ubot have this function? Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted December 14, 2011 Report Share Posted December 14, 2011 Define Command This can be used to "Yes" Lighten your code for repetitive tasks. Simply Define a New command. Name it and place all the nodes in there that you are going to run over and over again at different points of your application. Or Create a Define Command that holds all the account creation information, that you will then place into a loop and repeat the same process over and over again Define command will also help you in that stead of having to copy and paste all the nodes, or recreate it in another bot. If you need to transfer the code quickly and easily you can copy the define command and paste it into another bot your working on and all the code will transfer easily. Define a Function Defining a Function is a bit more complex. This with used will return a value. That you can set to a variable. Much like the Current functions available in Ubot now you can create your own Custom Functions and return the result to a variable, and do with it as you need. Remote include of commands, functions, or files is not currently supported. TJ Quote Link to post Share on other sites
mdc101 15 Posted December 14, 2011 Author Report Share Posted December 14, 2011 Thanks for the feedback Quote Link to post Share on other sites
Jubu 1 Posted June 30, 2012 Report Share Posted June 30, 2012 Define a Function Defining a Function is a bit more complex. This with used will return a value. That you can set to a variable. Much like the Current functions available in Ubot now you can create your own Custom Functions and return the result to a variable, and do with it as you need. Remote include of commands, functions, or files is not currently supported. TJDo you have an example of a define function? I feel like it might be something I'm missing out on. Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted June 30, 2012 Report Share Posted June 30, 2012 this shows how functions can be returned to a variable.. set(#test, $data returned(), "Global") define $data returned { return($add(1, 2)) } Quote Link to post Share on other sites
shanepax23 0 Posted December 2, 2013 Report Share Posted December 2, 2013 what would you set as the parameter if you want to put all of your commands within a define command? 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.