If Else Endif
The IF ELSE ENDIF construct is the third great building block of computing languages. At many points in your program, you'll have to check something and then execute different commands depending on the outcome. To check things you use the IF command. Hopefully, you should by now be able to make a good guess no pun intended as to what this code is attempting to do. If the variable Guess equals 1, then go to a procedure called GuessRight . If Guess equals 2, then go to a procedure called...
Building a Menu System in OPL Code Cascading Menus
As well as separate menu cards, there is another way to present information in a menu. This is through the use of cascading menus. A cascade in this respect is a menu option that, when selected, will pop up a second list of menu options the user can choose from. To use this feature, you firstly define the cascading menu by using the mCASC command, in the same way as you would use the mCARD system. The title first string in mCASC must be the same text as the menu option that will call up the...
MiniMax Advanced AI
While we're not going to go into depth on actually programming the Mini-Max method of doing A.I., we'll talk about the principles here and leave the actual coding of the system as a project for you. Mini-Max is named after the principle of minimizing your opponent's chances, while maximizing your own. We've actually already done half of this operation in our simple rule, where the computer always plays the best move available, maximizing its opportunity. What the computer fails to do here is to...
EpocSync by Malcolm Bryant
Malcolm Bryant isn't a programmer, but he's still created one of the most unusual OPL programs out there. Malcolm found that he was constantly beaming the same files between his Psion netBook and Revo during the day. So he decided to automate the process. EpocSync was the result. On lining up the infrared ports of the two machines and running EpocSync on both machines, they would connect to each other, and ensure that the latest copy of each file in a list the user creates is on each machine....
OPLTran for File Conversion
As noted earlier, OPLTran requires your source code to be an ASCII ANSI text file 7-bit character representation , not Unicode text. Symbian OS uses Unicode throughout, so if you are moving a text file from the phone e.g. an export of source code from the Program application then you GATHERING TOOLS will need to use the convert function of OPLTran This will take our source code file called Tim.tpl, and change the format. If it is ASCII ANSI , it will be converted to Unicode. If it is Unicode,...
HotKeys
We've stressed that we use hot key values in the menu system. We also have a separate routine in Event Core that reads in hot keys from the keyboard if present . As you know, Symbian OS applications can often achieve the same result in many different ways. One example of this is choosing a menu option. For example, the option to show an About box can be called by a hot key combination on the keyboard or by selecting the menu item itself. This is how we implement menu functions - by ensuring...
Translation from PC Command Line
As mentioned previously, OPLTran is a command line tool you can use to compile OPL source code on your PC. Open up your command prompt, and navigate to the directory with the Hello World source code. If you are using the directory structure we've suggested, you should find it at Type in the command line This will compile the code into a file called HelloWorld.opo. This file should be copied from your PC to your Symbian OS phone.