UBot Basic Training Boot Camp Tab 3 Documentation For The Native Browser

UBot Studio – Stealth

Basic Training – Tab 3

Boot Camp

For the Native UBot Browser

 

 

Welcome back UBotter!

 

 

In this tab we cleaned it up a little bit so we can focus on some new functions and commands. Scroll on down to the area in between the dividers inside the loop there. Dividers are just a way to visually separate your code to quickly find stuff. Okay, you find the loop?

 

This section tackles the problem of choosing multiple toppings for every customer in the %user data list. Her e we will do it very basic and step by step and in the next tab we will refactor it into cleaner code. This make it easier to understand what you are doing while you are building some complicated sequences.

 

The first set command inside the loop we will use $rand to pick a random number between 1 and 4. We can also use $spin and I do recommend it over $rand for a small list(1,2,3,4). Just seams to be more random that $spin but, at the end of the day there are many ways to do it and it is your choice.

 

Next we have a clear list, this is to clear the named list on on each loop. In each loop we will be building a list of random toppings each customer wants on their pizza. Am I making you hungry yet?

 

Moving on to the “loop while” command, usually this will loop while a condition is met. Much like the “If” command(statement). In our case we will loop while the random number in the #LW_rand number variable is NOT equl(!=) to the list total of the %random_toppings list. You still with me?

 

So, if the random number 3 is in #LW_rand number the “loop while” will run the commands inside it which in this case we are adding items to the list. In the “set” we are getting a random list item form the list inside “$list from text”(there’s that function again). Yes, we could use something else but I wanted to show you another cool function.

 

 

 

Cool, we have a #topping now we add it to the %random_toppings with “add item to list”. Inside that command we have some advanced options, we are using the default “Delete” the duplicates here. We want this because it will delete the toppings until we get our desired quantity in the list. See how cool that is?

 

So to recap, #LW_rand number will determine how many toppings and the “loop while” will add toppings to %random_toppings until we get the required quantity. Which will be no less than one and no greater than four. Yes, that was a little complicated but this is a useful concept to grasp and has many use cases in the wild.

 

In the next loop we loop %random_toppings and simply check the corresponding check boxes. If you read the source code those topping names are coming from the element attribute “name”. So I didn’t just pull those names from my head.

 

 

 

 

 

Time element

 

In the “set” we choose a random number in the list. Then we use “If” to compare the number to 11. When it = 11 it will be an AM delivery for that customer. Else it will be any other time.

 

 

You can look at the source code to get the hours of operation. To easily read the source just right click o the browser and choose “view source” towards the bottom.

 

 

In the “Type Text” we can see we can drag multiple variable and functions in the text field. You can do this in most of the fields In UBot. Lovely? Good then!

 

 

Were done with the new stuff here so you can test your commands with F5.

All Good?

 

 

Great let’s wrap this up in the next tab and do a little more refactoring.

Save

Posted in Basic Training.