are hyperlinks and object links the same thing?

I found the following code in the documentation at http://docs.textadventures.co.uk/quest/guides/hyperlinks.html

Here is some text with an <a href="http://textadventures.co.uk/forum/quest">anchor link</a>,
  a link for <object verbs="Look at/Examine">me</object>
  and a link for a <command input="wait">command</command>.

But when I inserted this as a scripted message in the room description, the only active link it produced was the anchor link. The other two links were not available.

But when I add another line of my own code to the message

and another object link {object:spell book}

the link to the spell book object with all its associated verbs shows up as I had hoped. Why is the code sample provided in the documentation not working for me, and why is this rather easier formatting {object:spell book} not shown in the same place in the documentation?

Second question: is there a simple function in the core to print a formatted list of object names when given an array of objects? My code below is a start, but the formatting is a mess and I don't want reinvent the wheel if there is already a built in function to print a neatly formatted list with commas, appropriate articles, a conjunction, and maybe even some hyperlinks.

          msg ("This is the leather book I use for spell casting.  I am able to cast ")
          foreach (x, GetAllChildObjects(this)) {
            OutputTextNoBr (x.name)
          }```

To the first question, I have no idea. I think the <object> syntax might have been used in a previous version of Quest?

The second question, I think you want:

msg (FormatObjectList ("This is the leather book I use for spell casting.  I am able to cast ", this, "and", "."))

(it confused me at first, because even though the function is called FormatObjectList, the second parameter is a room or container, not an objectlist)


(it confused me at first, because even though the function is called FormatObjectList, the second parameter is a room or container, not an objectlist)

I had the need for a similar list but the objects are located in different objects so I made this script to retrieve all of the object's name from all locations and used FormatList with the text processor, {object:" + object.name + "}

Edit: Note: Objects must be reachable for the player in order to have a hyperlink. I have a scenery inventory following the player it's set open at the start to get the hyperlinks and it's closed after the first action so that the inventory pane doesn't clutter.

mtr_name_list = NewStringList ////////////Edit: need the list first///////
foreach (mtr, GetDirectChildren (inv_materia_f)) {
  get_mtr_name = mtr.name
  if (mtr.mtr_amount > 0) {
    list add (mtr_name_list, {object:" + get_mtr_name + "})
    msg ("" + FormatList (mtr_name_list, ", ", "and ", "You have no materia.")  + "") 
\\\\\\\\\\\\\\OR\\\\\\\\\\\\\\\\
    msg ("" + FormatList (mtr_name_list, "</br>", "</br>", "You have no materia.")  + "")
  }
  else if (mtr.mtr_amount = 0) {
  }
}

Since I decided to go with a vertical list I dropped the FormatList function completely. Instead I have 6 For each scripts and at the end of each I print a line with the object link.

msg ("> show materia<br/>")
foreach (mtr, GetDirectChildren (inv_materia_f)) {
  get_mtr_name = mtr.name
  if (mtr.mtr_amount > 0) {
    msg ("{object:" + get_mtr_name + "} x " + mtr.mtr_amount + "</br>")
  }
  else if (mtr.mtr_amount = 0) {
  }
}
foreach (mtr2, GetDirectChildren (inv_materia_fs)) {
  get_mtr2_name = mtr2.name
  if (mtr2.mtr_amount > 0) {
    msg ("{object:" + get_mtr2_name + "} x " + mtr2.mtr_amount + "</br>")
  }
  else if (mtr2.mtr_amount = 0) {
  }
}
foreach (mtr3, GetDirectChildren (inv_materia_s)) {
  get_mtr3_name = mtr3.name
  if (mtr3.mtr_amount > 0) {
    msg ("{object:" + get_mtr3_name + "} x " + mtr3.mtr_amount + "</br>")
  }
  else if (mtr3.mtr_amount = 0) {
  }
}
foreach (mtr4, GetDirectChildren (inv_materia_bf)) {
  get_mtr4_name = mtr4.name
  if (mtr4.mtr_amount > 0) {
    msg ("{object:" + get_mtr4_name + "} x " + mtr4.mtr_amount + "</br>")
  }
  else if (mtr4.mtr_amount = 0) {
  }
}
foreach (mtr5, GetDirectChildren (inv_materia_bfs)) {
  get_mtr5_name = mtr5.name
  if (mtr5.mtr_amount > 0) {
    msg ("{object:" + get_mtr5_name + "} x " + mtr5.mtr_amount + "</br>")
  }
  else if (mtr5.mtr_amount = 0) {
  }
}
foreach (mtr6, GetDirectChildren (inv_materia_bs)) {
  get_mtr6_name = mtr6.name
  if (mtr6.mtr_amount > 0) {
    msg ("{object:" + get_mtr_name + "} x " + mtr6.mtr_amount + "</br>")
  }
  else if (mtr6.mtr_amount = 0) {
  }
}

I haven't tested the first variation and wrote it from memory but I remember there was no problem. Maybe this one's a error.

The second variation is what Im using now. A vertical printed list with hyperlinked objects. Edit: The objects are im different locations because it's a bunch of 30 raw materials for crafting in six categories; fantasy materials, sci-fi materials and materials in both categories.



This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums