contents.gifindex.gifprev1.gifnext1.gif

pueblo00000000.gif Using image maps with worlds

Pueblo allows you to use image maps with your existing worlds. It’s a fairly simple process. Simply specify the image with the ISMAP attribute within an anchor statement. Here is an example:

<a xch_cmd="do_map">

<img src="http://…/world_map.gif" ismap>

</a>

Note that the anchor statement is using the xch_cmd attribute rather than the standard ‘href’. The use of this attribute is explained on the anchor element page. Basically, xch_cmd causes the specified command to be sent to the world from the client. Thus, when the anchor is clicked, the string “do_map “ should be sent to the world. This isn’t completely right, however. Read on…

Note that the <img> element contains the ‘ismap’ attribute. This attribute indicates that the image is a map. This means that when you click on this image in an anchor, the coordinates of your click are appended to the anchor, in the form ?x,y. In Pueblo, the coordinates are appended to the xch_cmd value from the <a> element. Thus, if you click in the above image map anchor, the following string could be sent to the world:

do_map ?100,50

This means that the image was clicked on the pixel that is 100 over from the left and 50 down. (The question mark and comma are always sent as delimiters.)

Note that the space is only sent between the command and the question mark if you specify it in the xch_cmd attribute. For example, if the image anchor were specified like this:

<a xch_cmd="map_click">

<img src="http://…/world_map.gif" ismap>

</a>

Then the click would be sent to the world in the following form:

map_click?100,50

As a world programmer, you’re responsible for processing the command and interpreting the coordinates that you receive.

Also see

<a>

<img>

xch_cmd

xch_hint