Tip of the Week

April 4, 2008 – 6:02 pm

Here’s the ‘tip of the week’! (Even though there hasn’t been a new post in weeks :P)

Do you want to display item/unit/building information on your PBBG, but find that your tables are getting too big, and your divs are cluttering up the page? Use tooltips to display this information in a compact and stylish way!

There are several ways to do this, and of course you can customize your tooltips so they fit right into your PBBG. There are already a few javascript libraries available on the internet which will allow you to use tooltips easily, so I will introduce two of these libraries. If you don’t like them, I’m sure there are more on the Internet!

BoxOver
This is a javascript library that is used by Google on Google Sites (read more about BoxOver on its wikipedia article). Unfortunately, at the time of writing the official BoxOver website is not available. I did find a copy of the Javascript file however. With this library, you set all the tooltip texts/header/styles/other options by using the title attribute in your HTML tags, so it is possible to use these tooltips on many HTML elements.
Examples: http://www.norfolk.gov/cultural_affairs/boxover/example.html

Walter Zorn Tooltip
This library is a bit more advanced than the BoxOver library, and allows you to write your own extensions to create amazing tooltips! However, it may be slightly harder to use/set up, as you must use the onmouseover and onmouseout triggers to display/close tooltips.

Here are some ideas you might want to try out when using tooltips:

  • Create your own tooltip! Make it match your game’s style and theme so it will be unique!
  • You could also try using AJAX to directly fetch information from a database, so that the information you present will never be out of date and will require little maintenance!
  • Use HTML! The libraries I introduced above allow HTML in the actual tooltip text, so don’t hesitate to add images and tables.
  1. 6 Responses to “Tip of the Week”

  2. Thats a good ideea but yor script will be more complicated.

    By sem on Apr 6, 2008

  3. Well, this is only an HTML/javascript addition to your files.

    I keep my template files separate from the code, so it’s not hard for me to add this, and it doesn’t make the code any harder either.

    By Andy on Apr 6, 2008

  4. How?

    By sem on Apr 19, 2008

  5. Well, as an example, I use Smarty (http://www.smarty.net). You could also use other templating systems.

    By Andy on Apr 19, 2008

  6. That’s pretty cool!

    It looks like BoxOver’s site (http://boxover.swazz.org/) is back up again - definitely going to have to bookmark that.

    By Luke on Apr 30, 2008

  7. Thanks for the tips, didn’t really think of doing tooltips, i may add a few here and there to deathmatch.

    Nice blog by the way.

    By liam dawe on Jun 10, 2008

Post a Comment