How do you display an exit link without showing the cardinal direction using the Text Processor?

Nemec
28 May 2022, 20:43

In my game the player does not know which cardinal direction they are facing. Unfortunately the {exit:name} automatically displays the cardinal direction, and {object:exit_name:text} only displays the text without a link (I am guessing this is because an exit does not inherit defaultobject). Too bad there isn't a {exit:name:text} option. I do want to use the exit's [GO] verb and the rest of it's functionality.

Edit: I forgot to mention that I am using the exit's alias (north, south, east,...) in my code so I cannot change these without majorly messing up the game.


DarkLizerd
29 May 2022, 03:43

Like this?
You can still go North, East or South from the first room, or "go R1" to goto R1 from Room.
I wonder if deleting these lines will prevent that??? (Testing now)

 <inherit name="northdirection" />
<!--Saved by Quest 5.8.6836.13983-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="test_01">
    <gameid>79c3e824-e31a-4cc9-997a-b70fddc30a8d</gameid>
    <version>1.0</version>
    <firstpublished>2021</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <beforefirstenter type="script">
      msg ("So, what shall I call you?")
      get input {
        player.alias = result
        msg ("Hi {player.alias}, how are you today?")
      }
    </beforefirstenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="R1" to="R1">
      <inherit name="northdirection" />
    </exit>
    <exit alias="R2" to="R2">
      <inherit name="eastdirection" />
    </exit>
    <exit alias="R3" to="R3">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="R1">
    <inherit name="editor_room" />
    <exit alias="Room" to="room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="R2">
    <inherit name="editor_room" />
    <exit alias="Room" to="room">
      <inherit name="westdirection" />
    </exit>
  </object>
  <object name="R3">
    <inherit name="editor_room" />
    <exit alias="Room" to="room">
      <inherit name="northdirection" />
    </exit>
  </object>
</asl>

DarkLizerd
29 May 2022, 03:49

Yep, it does prevent using direction to move.
"N" or "North" doesn't work
but you can "go R1".


Nemec
29 May 2022, 05:56

Does that mean I would have to alter every exit manually? If so, that would unfortunately be a no go. I have hundreds of exits that would need altering. I do greatly appreciate the insight however. That's an approach that I haven't considered and may look into for other purposes.


jmnevil54
29 May 2022, 16:38

Just click off the option to have the exit link, then do something like {command:exitname}


Nemec
29 May 2022, 21:28

jmnevil54
It seems that would work perfectly. I simply access the alias of the exit and use it with the go command:

some_string = "{command:go " + ext.alias + ":" + some_exit_descriptor + "}"
msg(some_string)

now all my exits will show the desired description rather then the exit's direction. Such a simple solution. I was making this way more complex then it really was.


mrangel
01 Jun 2022, 14:59

You could try modifying the core function ProcessTextCommand_Exit if you want to do this for all exits.

Something like (off the top of my head):

  <function name="ProcessTextCommand_Exit" type="string" parameters="section, data">
    <![CDATA[
    exitname = Mid(section, 6)
    colon = Instr (exitname, ":")
    if (colon = 0) {
      exit = GetObject(exitname)
      if (not exit = null) {
        alias = GetDisplayAlias (exit)
      }
    }
    else {
      alias = Mid (exitname, colon + 1)
      exitname = Left (exitname, colon - 1)
      exit = GetObject (exitname)
    }
    if (exit = null) {
      return ("@@@open@@@" + ProcessTextSection(section, data) + "@@@close@@@")
    }
    else {
      verbs = GetDisplayVerbs(exit)
      command = LCase(StringListItem(verbs, 0)) + " " + alias
      style = GetCurrentLinkTextFormat()
      return ("<a style=\"" + style + "\" class=\"cmdlink exitlink\" data-elementid=\"" + exit.name + "\" data-command=\"" + command + "\">" + alias + "</a>")
    }
    ]]>
  </function>

Then you can do something like {exit:exitname:some descriptive label} like you do with {object: