Jump to content
UBot Underground

Recommended Posts

Hello ,

I'm new to ubot and each time i'm building a new bot i'm not building it perfectly as far as user input. I'm not sure what to do exactly.

 

Example:


There are 2 input field , user can input only 1 or the 2.

How do you manage this ? Currently if there are two input field and only one is filled script will say there is a problem ( ofcourse). How do you handle those type of situtation ?   With Else if ?

If user input  = $nothing  , then , Else "script" ?

I'm often having those issue when there is user input i'm not really sure how to code the bot to answer wrong manipulation user would do ( and there are obviously alot more than the example i've given i just can't really remember them right now). Since most of my bot are for personal use i manage without but i'd like to know more.

Thanks

Link to post
Share on other sites

Edit : Misread

Lets say there are 2 ui text boxes, else if would be the way to go if it has to function differently. If you really want to be anal about things (such as alert the user if they didn't fill out a field) you can also include an else if with an alert/prompt/confirm. 

  • Like 1
Link to post
Share on other sites

Set #input1 to $nothing, Set #input2 to $nothing. Add a button (labeled 'Continue') below your 2 inputs that links to a define called Check Input1. In that define, use:

- - - - - - -

if #input1 = $nothing

  Load html (<html><body>
<center><h1>Oops!</h1></center>
You must enter something in the box labeled 'Input 1'. <br><br>
After entering data into the Input 1 Box, Click on the "Continue' button to proceed.<br><br>
</body></html>

 

Wait 2 seconds

 

Check Input1

- - - - - - - -

 

Below this define, create a similar define for Input2.

  • Like 1
Link to post
Share on other sites

Thanks both of you that was the kind of ideas i was looking for. One last thing , how can you make " alerts " ?

I would like to get the content of the error and display it to the user is that possible ? what i mean by " content of the error " is actually what ubot display when there is a problem.
Kind of the same way we do in php for error debugging ?

Link to post
Share on other sites

There's a few ways to do this

Commands :
Alert - pops up a msg box with whatever you want. It's a stand alone. 

Functions
Prompt - pops up a message with a user filled text box. You can put it in a set command
Confirm -  Similar, instead of a text box its a yes/no (true/false) and can be put into a set command also
 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...