Command Links in WebUI

I’m trying to create a function that I can call from any text (most often, a room description) that will use the standard command hyperlink if the WebUI is not in use, and the <> method if the WebUI is in use. That way, I can decide later whether to make the game playable online.

It’s not easy for me to see how to set this up. Here’s what I have so far:

link(str) { #ifdef TADS_INCLUDE_NET "<<aHref(str)>>"; #else "<A HREF=str>"; say(str); "</a>"; #endif }
The idea being that, in the room description, I can write things like, "A brick path leads away to the <<link(‘north’)>>. "

This doesn’t work. I haven’t tried it with the WebUI yet, but in normal adv3 mode, TADS thinks the command on the command line is “str”, not “north”. I’ve tried stuffing extra single-quotes around it – that doesn’t work. I looked through the article on Strings in the manual, and didn’t spot anything helpful.

Has anyone tried this yet? What do I need to do?

My understanding is that aHref works for both WebUI and standard UI games, and a quick glance at the Library Reference Manual seems to back this up. Have you had problems using aHref with the standard UI?

Hadn’t thought of trying that. I’m fiddling with it. Probably user error.

Okay, the aHref tag works identically in both web and non-web delivery. All that seems to be needed is a function along these lines:

link(str) { "<<aHref(str)>>"; say(str); "</a>"; }
With this in place, the room description can say things like “…to the <<link(‘south’)>>, a brick path…” This is fairly tidy. It saves some typing. A bit more work would be needed to create links for object names so that they could be examined by clicking, but … hmm, maybe I’ll try that too.

Thanks!