A good uBot loves to talk. We’ve seen already how uBots talk to the browser. Well, uBots also have a language for talking to the user! Yes, uBots are multi-lingual.

A uBot can talk to the user (either you or your customer) through the uBot’s UI, or user interface. In UBot Studio, the UI looks a lot like the UI of other software and web pages – with text boxes, drop down boxes, checkboxes etc etc.

 

UI Commands

UBot Studio has several ways of letting you build UI. One way is through UI commands. When you drag a UI command into your script, UBot Studio immediately recognizes it and adds the UI element to the UI panel. Here’s what that looks like:

uitext

Almost every UI command is tied to a variable. The variable will automatically update if you change the UI element (for instance, if you type into a textbox). Likewise, if you change the variable, the UI element should update.

uidebug

Most of the UI commands are just the various UI elements that you can add to your UI panel.
I encourage you to play with them and see how they look. A few UI commands have special purposes.

 

UI Stat Monitor

Most UI elements give you a means for modifying variables. ui stat monitor is different, in that it’s intended purpose is to report a variable back to you. Additionally, you’ll find that it doesn’t force you to pick a variable, but instead lets you display whatever content you like. This is in case you want to show some text with your variable, or perhaps more than one variable, like this:

set(#x,0,”Global”)
set(#y,0,”Global”)
ui stat monitor(“Location:”,”{#x},{#y}”)

It’s possible to even put functions in the ui stat monitor, but we strongly recommend that you don’t. Doing so can cause system lags, because ui stat monitor is refreshed frequently.

 

UI Button

The ui button is another special UI element. Instead of interacting with a variable, ui button is a container for other commands. When clicked, ui button will run the commands inside.

uibutton

UI Log View

The ui log view has no parameters and doesn’t interact with a variable. It’s only purpose is to display the log to the user. If any log commands are used throughout the script, the will be displayed here.

 

UI Window

There are situations where you’ll find you need to have more UI than you have space. You can organize your UI by putting some of it into a ui window. This command only has one parameter: “label”. The label will actually be the label for a menu item that will appear under the “settings” menu when you create this command. If you click the menu that was created, it will load a new window.

Uiwindow

You can fill that new window with UI by putting UI commands inside the ui window command.

 

UI HTML Panel and UI HTML Window

These commands are available only in UBot Studio developer edition. They allow the bot creator to build their UI in html instead of the UI commands. We won’t get too deep into this here, as this is more of an advanced topic.

 

The UI Editor

Last but not least, we have the UI Editor. This is not tied to any command, and if you use it, you do so instead of using other commands. The UI editor gives you an easy drag and drop system for creating simple UI.

Wikiuiedi

When you click ok, your script’s UI will be taken over by the UI created in the UI Editor. Alternatively, if you have UBot Studio Developer Edition, you can convert your UI into html, which you can further edit manually.

 

A Note About Scripts

Each script gets its own UI. When you add UI, through commands or through the editor, you’re doing so for that script only. Switching between scripts will swap out the UI in the UI panel. So will switching between tabs. (that’s right, each tab can have its own UI.)

tabsui

UI is one of those things that can make a script much easier to work with. You don’t technically need UI, as you could just edit your script every time you need to make a change. But doing this is dangerous. When you have a working script that you’ve tweaked and debugged to perfection, the last thing you want to do is start editing it. UI gives you a way to talk to your scripts directly without having to change them. And it lets anyone else that might use your uBot talk to it, too. And uBots like it when you talk to them. They’d get lonely otherwise.