Liberty Basic 3.02
What About Windows Using Standard Windows Widgets Something I've been wanting to cover is the integration of standard Liberty Basic dialog boxes into the Magic 6 ball program. Liberty Basic has three such standard dialog boxes which can be used, and we will be using all three.
They are the PROMPT dialog box, the NOTICE dialog box and the CONFIRM dialog box. The first one we will use is the NOTICE dialog box. This is what we call a Windows widget. It is a prepackaged Windows tool we call.
It will show a basic Windows style dialog box with the message we pass it. Here is the syntax for the command from the Liberty Basic Help file.
Description: This command pops up a dialog box which displays 'string expression' and which has a button OK which the user presses after the message is read. Pressing Enter also closes the dialog box. Two forms are allowed. If 'string expression' has no Cr character (ASCII 13), then the title of the dialog box will be 'Notice' and 'string expression' will be the message displayed inside the dialog box. If 'string expression' does have a Cr character, then the part of 'string expression' before Cr will be used as the title for the dialog box, and the part of 'string expression' after Cr will be displayed as the message inside. Further Cr's will force line breaks into the text contained in the message. Usage: notice 'Super Stats is Copyright 2001, Mathware' Or: notice 'Fatal Error!'
Download Liberty BASIC. You don't have to worry about your trial period running out! Liberty BASIC is not time limited shareware! Take as long as you need to evaluate.
+ chr$(13) + 'The entry buffer is full!' So as the help file says, it shoots a dialog box up onto the window with the text you give it. You can experiment with this really easy. Open a new, blank page in Liberty Basic and type the following. 'The Magic 6 ball - version 3 'Written by Joshua Moore and Brad Moore' 'Copyright 2002, all rights reserved 'written for LB3.x 'You are free to incorporate any portion of this code 'into your own programs without notification or credit 'to the authors. Please do not distribute as-is. 'DIMension a string array to hold the answers DIM answer$(6) 'Now assign the text strings to each array member answer$(1) = 'MAYBE.'
Liberty Basic 4.04
Answer$(2) = 'NO! - Never - Don't ask again!' Answer$(3) = 'Its not clear now.'
- Basic interpreter inspired by QBasic that allows development of GUI programs in addition to CLI programs. The author has discontinued the development of.
- Liberty BASIC all versions serial number and keygen, Liberty BASIC serial number, Liberty BASIC keygen, Liberty BASIC crack, Liberty BASIC activation key, Liberty.
Answer$(4) = 'Yes' answer$(5) = 'Probably not.' Answer$(6) = 'You can count on it!' 'Start the interaction with the user Notice 'Hello - I am the Magic 6 ball - I can tell the future. ' + 'After we have been introduced, you will have a chance to ' + 'Ask me a yes or no question and I will tell the answer!' Observe that the notice command span three lines of text. I could have written this statement on a single line, stretching way out to the right in the editor, but for readability and easy of understanding I choose to split the statement over three lines.
This is possible because of the continuation character at the end of each line of the statement (except the last line - there is nothing to continue there). The continuation character is the underscore ' and it signals to Liberty Basic that the current line extends on to the next line.
The next command is the PROMPT command. It is great for getting quick and dirty input of a value, but it lacks features of the NOTICE and CONFIRM commands, such as dynamic sizing and modifiable titles. Also the current version of Liberty Basic (3.02) will only allow PROMT to return a string variable (this is not a issue for us though). PROMPT opens a dialog window and displays a short string of text. Then it waits for the user to type some data into the text field and then click the OK button.
It will return the text the user entered into the string supplied as one of the parameters of the command. Here is what the Liberty Basic Help file says about PROMPT. PROMPT string; responseVar$ Description: The PROMPT statement opens a dialog box, displays string, and waits for the user to type a response and press 'Return' (or press the OK or Cancel button). The entered information is placed in responseVar$.
If Cancel is pressed, then a string of zero length is returned. If responseVar is set to some string value before PROMPT is executed, then that value will become the 'default' or suggested response. This means that when the dialog is opened, the contents of responseVar$ will already be entered as a response for the user, who then has the option to either type over that 'default' response, or to press 'Return' and accept it. A simple experiment in a new Liberty Basic programming window shows the following prompt for the command below.
The following code shows the next section of the program using the PROMPT command to get the users name, and just a little bit further down it is also used to get the users question. Notice also that if the PROMPT command returns an empty string (which it will do if the Cancel button is clicked, or if there was no input and the OK button was clicked) that the NOTICE command is used to warn the user of the error and then the user is returned back to the PROMPT command to get the data again. Here is the next section of program that demonstrates all of this.
getPlayer prompt 'You know me, but who are you (enter name)?' ;name$ if name$ = ' then Notice 'You did not enter anything for your name! - Try agian.' Goto getPlayer end if loop Prompt name$ + ' Ask Magic 6 a 'yes' or 'no' question.'
;question$ if question$ = ' then Notice 'I am sorry, I did not hear you. Perhaps you should type a little louder.'
Goto loop end if 'get a random number between 1 and 6 number = int(rnd(1).6) + 1 'now simply print the answer Notice 'Magic 6 ball says: ' + answer$(number) By using the NOTICE and PROMPT commands we have simplified our code even more. There are no more print statements to the Liberty Basic console, which saves a lot of code that we used in formatting the output to the screen. The final widget that is used is the CONFIRM command.
It is useful when we are asking the user a Yes or No question, such as 'Do you wish to play again'. The CONFIRM command will return the value of the button the user clicks, whether that is 'yes' or 'no'. The value is returned into the string variable that is passed as a parameter to the command.
At&t Internet Basic 3
Here is what the Liberty Basic Help file says about the CONFIRM command. CONFIRM string; responseVar Description: This statement opens a dialog box displaying the contents of string and presenting two buttons marked 'Yes' and 'No'. When the selection is made, the string 'yes' is returned if 'Yes' is pressed, and the string 'no' is returned if 'No' is pressed. The result is placed in responseVar. We want to use the CONFIRM command to find out whether the user wants to play the game again. The implementation is simple and straight forward.
We pass a string with the query 'Do you wish to play again' and then capture the response in the variable answer$. Right here I want to point out the difference in variables. The array answer$ is not the same variable answer$.
They are not related. I just noticed that they were similarly named, but they do not have any relationship with each other. Every character counts in variable naming. Case is also very important. If your program is not behaving the way you suspect it should, investigate your variable names.
You might have a misspelling, or mixed case issue. So having said this, lets take a look at the end of the program.
Liberty Basic 4.04 Download
Download Liberty BASIC Download Liberty BASIC You don't have to worry about your trial period running out! Liberty BASIC is not time limited shareware! Take as long as you need to evaluate the software. Download Liberty BASIC v3.01 Trial (only $39.95 to register) This version of Liberty BASIC is fully 32-bit and runs under Win 95/98/ME/NT/2K/XP.
Trouble downloading? Download Liberty BASIC v2.02 Trial (only $24.95 to register) This is a 16-bit Windows application. It works on all versions of Windows but is best suited to Win 3.x/95/98/ME.
Get (about 1.7MB) Get (about 1.6MB) Trouble downloading? Or if you use OS/2. (this version is old, but free) Get (about 1MB).