Interlude - Why doesn't this #*$#ing thing work? 1 - The debugging tool

By now you've done some programming, and quite probably made some mistakes. There's a technical term for these that you've probably heard: bugs. If you haven't made any yet then I can guarantee it won't be long till you do, it happens to the best of us. Some times it can be quite hard to work out what's going wrong, but help is at hand in the form of a handy debugging tool.

As an example. You have a fancy entry hall in your place, all big mirrors and chandeliers. You'd like to have an extra piece on top just for clan members - “A smartly dressed butler greets you 'It is always an honour to host a member of [YOUR CLAN NAME HERE] here.' as he bows low.”

Easily done. Decorate a separate page with the 'butler' message, make sure it's hidden, and install the following program in the room.

 Clannie members get special treatment

Now just check that it works as desired. Go 'Back to the Room you came from', leave, and reenter. No butler! Go back to the program. First line, check that you're in the clan, tick so now second line show the appropriate page, tick. Why isn't it working? Try again. Go back to the room. Leave, reenter. Still no butler. You're definitely in the clan, you've been in the clan halls often enough. What's going wrong?

This is where the debugger comes in. What this does is to show you what the program is doing, step by step. To use it click on the button marked 'Turn on debugging' down there on the left, under Keybearer Options. Click on it now and you'll see something like this.

 all is not right

Now look at this. First it tells you what program it's running, in this case the program called 'Show Butler', the one you've just written, as desired. Good start. Note that you are told not just the name of the program but it's ID number as well, in case you have more than one program with the same name.1) Row 1. Good. Start at the beginning. So often a good idea. The first gadget encountered is the Clan contrivance as expected…but what's this? “Currently set to pass if the player is a member of SoC”? That's not your clan! You're in MyClan (MC)! That's where the mistake must be. And indeed, the next line tells you that this contrivance has not passed and so the program doesn't proceed to the second row and instead terminates. It also says something about an 'Escape Hatch'. Don't worry if you don't know what this is, we'll get to that later in the series of tutorials.

Now you can turn off the debugger, go back to the program, and change the preference in the Clan contrivance. Going back to the room you find that your program now works properly. Hurrah!

So there we have it, the debugger, a very useful tool. If you do much programming then you will find yourself using it regularly.

I find that the best way to use the debugger is to have the program in mind and how it's meant to run, then read through the debug report step by step comparing it with what you expect to happen.


Sometimes you may have a problem with a door that should be locked, but this doesn't appear to happen. The problem may well be that you're the Place owner. This means that for you, and holders of certain keys, every door is automatically unlocked. This will override everything else, including programming.

In general a Place can look quite different to the owner than to a regular visitor. For this reason, it's a good idea when testing your programming to go through the whole Place with an alt, one with no special key privileges. This will give you a better idea of what your place looks like to the casual punter, although bear in mind that this will vary according to what sort of device they are using to play the Island, and which browser they may be using etc.


Return and carry on through the tutorials.
Return whence you came.
Return to Introduction to Programming.
Return to Places Overview

1)
Bad idea. Leads to confusion. Try to avoid doing this.