Home Developers Products Careers Login/Downloads Contact us Support Press

 Dr. Pete's WMLScript Clinic

Oohh, tsk tsk tsk, another acute case of server addiction.

Don't worry, it's normal. Lots of people choose to write their dynamic WAP applications using server-side scripting. After all, this is what you've seen those "web application" developer types doing.

I have set up my clinic here at Yospace in order to show the world that you can, in some cases, wean yourself off that server. Do more on the handset and less on the server. How about writing your applications entirely in WMLScript? You may laugh, but you'll be surprised at what you can do, and you will also be surprised at how much faster your applications will seem to your users. Every time you avoid having to make a request back to the server, you save time!

In my clinic, you'll find some examples of WMLScript in action in some of the games found on Yospace's WAP site with some snippets of how these games work. I've also included my own recipe "code cures" which you should keep at hand for when your WAP applications start showing signs of unnecessary server dependency.


Check out the Games
Check out the WMLScript Code Cures
I've also set up a developer forum for swapping WML and WMLScript ideas. If you want to be a WMLScript Donor, email me at clinic@yospace.com.
Now relax and tell me if this hurts...

Games
Still don't believe the Doctor? Well, here is a list of the games that are available on the Yospace WAP site. All of these games uses minimal server intervention and all of their logic is run in the handset as WMLScript. Try any of them out by clicking on their 'Play' icon.

Yojack
Yospace’s implementation of the card game Blackjack.
Play
CODE! You can view the main WMLScript code used to run the game, including the intelligence written for the dealer, and I give a brief explanation of how it works.
Code listing
Red Dog
Another card game involving three cards. You have to lay bets on whether the third card will be between the values of the first and second card. The closer the card values, the better the odds!
Play
Paper Scissors Stone
Yep, you guessed it. Try and beat your phone at this classic game. Just choose your weapon and try your luck!
Play
Yozee
Yozee is much like the game of Yahtzee(tm). It's a sort of poker but with dice, not cards. The object here is to complete a score sheet with the highest point value as possible by rolling five dice. Three rolls of the dice are allowed, and on each roll you may hold any of the dice.
Play
Hunt the Wumpus
One of the first computer games ever -- it could even be played on a computer with teletype printer. You have to explore a series of rooms and shoot the Wumpus with your arrows. Use your arrows sparingly as you only have three.
Play
Poker Help
A few helpful hints and pieces of code to get you thinking.
CODE! Here I will give you a few helpful hints for creating scripting that detects the various win or lose conditions for a Poker game. This code is used in our Yozee game.
Tell me more

Code Cures
Keep these remedies at hand, they might come in useful. You are free to use these snippets for your own WML pages. The Doctor prescribes these WMLScript snippets "as is", which means they are completely without warranty. This means if they cause your WAP application to fail, mobile phone to melt, or give you bad breath, the Doctor or Yospace cannot be held responsible.

Email Validator
A function that checks whether a valid email address has been given. You would use this to warn users of erroneous entry before they submit their form to your server. Remember that you should always do the check on the server-side as well; the purpose of this code is to give the user feedback sooner rather than later.
CODE! Look at the WMLScript that makes it work.
Code listing
Date Validator
Enter a date and the program will check that the date is valid.
CODE! You can view the WMLScript code used to acheive this validation.
Code listing
Bubble Sort
Bubble sort is a well known memory-efficient method for sorting things into an order. In this program, you can enter numbers, and they will be returned in ascending order.
CODE! Look at the WMLScript that makes it work.
Code listing
Time zone
Enter the closest city to where you are now, the current time, and then select another city. The program will calculate what time it is in that other place. A trivial program that can provide the basis for your own time and time zone manipulation routines. I provide some helpful hints on how to alter this code to have it perform in different ways.
CODE! Look at the WMLScript that makes it work.
Code listing
About Yospace Privacy Legal Feedback