The Bricks That Build a Script

Imagine being a kid with a fresh new box of Legos. Imagine yourself making the most wonderful inventions with your Legos. Now imagine that if you put your Legos together in just the right way, money comes out. This is what it’s like to script in UBot Studio.

In UBot Studio, we communicate to the web browser and other systems with a visual scripting language called UScript. Scripts are made up of commands that stack on top of each other like bricks. Commands and all the other kinds of bricks are collectively called nodes.
The scripts are represented via the tab bar. Here, you can add, remove, and rename your scripts. This helps you organize your uBot – one script might scrape a website, and another might analyze the information from the website. This way you don’t have unrelated scripts stacked on top of each other!

 

r1VVcphI

An example of a command is the navigate command. When the navigate command runs, the web browser will navigate to a specified URL.

uMxBybtL

The navigate command knows where to navigate to based on its URL parameter. A parameter is a piece of input that you can give to commands and functions to be more specific about what you want them to do.

Some nodes will have advanced parameters. These are parameters that you don’t need most of the time, but every now and then they might be useful. In the case of the navigate command, there is an advanced parameter that tells the script whether or not to wait for the new page to load before moving to the next command. By default, it will be set to Wait.

gOZX4pV56H

Parameters can be a number of different types of input. Some will be plain text, others might be drop down boxes, some might be file browsers, and so on.

You can also fill a parameter with a function. A function is similar to a command except that it returns a value. An example of a function is the $date function. The $date function returns the current date and time.

A function can’t exist at the script level. That just means that you can’t simply drop $date into your script by itself to see the date – UBot Studio needs to know what you want to do with the date!  It can only live inside a parameter – either a command parameter or a function parameter. For the sake of experimentation, we can put a function inside an alert command, which will allow us to see what the function returns.

RVPYNHDO

There are other kinds of nodes that can be parameters too. A variable is a node that holds some text or numeric value. It can change over time. You set a variable to a value and you can use it later as a parameter.

SUDANwqP

A list is a node that can hold onto several pieces of text. With lists, you can freely add or remove items, or look at each of them, one at a time. Important note: A list is created the first time something is added to it, by using the add item to list or add list to list command.

T9QWmMrbjtsJ

A table is a node that can hold items in a way similar to a spreadsheet. A table has rows and columns. To create a table, you can just start adding cells to it, or you can use a command like “create table from file”. When you save a table, it saves to a .csv file, which you can then load back into UBot Studio with the create table from file command.

4hcxTvud

To look at the table we just created, we’re going to use the debugger. The debugger is a very useful tool that allows you to watch the values of all data nodes as they change. In the View menu, click Debugger, or press ctrl-D.

p9gKJSkLo0

Collectively, variables, lists, and tables are called data nodes.

(a quick aside to anyone with a programming background – “variable” has a slightly different meaning in UScript than in traditional languages. A variable in UScript is more like a string in other languages, whereas a data node is like a variable in other languages.)

And that’s it! From these 5 fundamental building blocks of UScript, people have made incredibly powerful, widely diverse bots, some of them earning their creators millions of dollars. How will you put your blocks together? What will you create?

PS – Don’t worry if this doesn’t all sink in immediately. In the following tutorials, we’ll walk through it slowly so you can see how it will help you make money.

post-57101-Star-Trek-Data-joke-I-can-see-MvW6