intermediate,part1, tab 1,featured,ubot expert,tutorial

UBot Boot Camp Intermediate Part 1 Tab 1 Documentation For The Native Browser

UBot Boot Camp

Intermediate Part 1

Native Browser Edition

Part 1 Tab 1


Hello! Back for more? Okay fellow Ubotter let’s get to it!!



In the first section before the divider we are creating some fake data to save to a file. The purpose of this data is to demonstrate one way to read in a file with UBot. The $special folder node is used often for saving and reading files form a hard drive or some type of storage device. In this function it has many options. we will use “Application”. This means it will use the current folder the .ubot or .exe is in, The extensions I use most are .txt and .csv. The next field is for the data you wish to save. This can be a %list, &table, #variable and in this case we are using some text. If you place this in an alert command you can see quickly what this function does with the desired parameter. This is also a good way to test what is in a variable at any given point or see what a function is returning. In this case $special folder returns a particular folder/directory path. Of course you can also use the debugger with Ctrl+d or in the UBot IDE click View at the top in the menu bar and click “Debugger”.




The first “save to file” node is saving our data that was used in the “Basic Training” to a file named user-data.txt in the same folder as your bot. In the “Content to Save:” field you can hard code some data as shown or you may use a %list or a #variable as well. In the second “save to file” we are saving some random sentences to be used for the delivery instructions. Be sure to add the backslash “\” after the special folder function.



In the “add list to list” command we are using a new function $list from file. Just add the file path to the file and you should be good to go. When it is called it will add the list in the file into %user_data list. If %user_data already contains data it will just append the new data to the named list. Hence the name “add list to list”.







If you type Alt+e+a, all the nodes will collapse. Then just open the loop up, inside the loop the logic is pretty much the same. Hopefully you will notice pretty quickly why I am using some comments and more specifically for nodes with the same name like “set header”. Often you can have several of these in a row or through out your script and it is difficult to remember what these are when the nodes are collapsed. However, it’s much cleaner with the nodes collapsed and makes it easier to traverse your code.


At the end of the loop I placed the “pause script” command so we can test if all is good with are new style of data input from a file traditionally called “file I/O” for input or output. I/O can also be from the internet and in most cases it usually those two when someone refers to I/O. When using the pause node in the is manner either to debug or test you can hit run/F5 and it will pause and you can keep using run/F5 to cycle the whole list if you like with out stopping. If you use stop it will stop at the first loop. Pause is a very useful way to debug and test new and old code in your script.

Okay, looks good! Right? Let’s head on over to the next tab and do some refactoring to reduce the lines in this bot.


Posted in Intermediate Training.