rogercd 3 Posted April 6, 2013 Report Share Posted April 6, 2013 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 Quote Link to post Share on other sites
merkaba 36 Posted April 6, 2013 Report Share Posted April 6, 2013 Edit : MisreadLets 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. 1 Quote Link to post Share on other sites
jomark3 25 Posted April 7, 2013 Report Share Posted April 7, 2013 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. 1 Quote Link to post Share on other sites
rogercd 3 Posted April 7, 2013 Author Report Share Posted April 7, 2013 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 ? Quote Link to post Share on other sites
merkaba 36 Posted April 7, 2013 Report Share Posted April 7, 2013 There's a few ways to do thisCommands :Alert - pops up a msg box with whatever you want. It's a stand alone. FunctionsPrompt - pops up a message with a user filled text box. You can put it in a set commandConfirm - Similar, instead of a text box its a yes/no (true/false) and can be put into a set command also Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.