Navigating in the description

Total newbie here so please forgive me if this is something obvious, it probably is because I've searched the forum and no one else seems to have had to ask.

I really want to include some navigation within my description so something like:

"The stairs will lead you down to the BASEMENT"
That way the player can click on BASEMENT within the description rather than relying on using the Places and Objects section or the Compass.

I know how to add objects into expressions: {"Move the " + ObjectLink(boxes) + "."} and I know exits and rooms are essentially just objects but no matter how I phrase it it just comes up with an error message.
Or it might require a simple line of code, either way, surely someone must know.

Any advice would be really, really appreciated.

Matty.


Make an object, IE. "hole" in the room.
Add a description like:
There is a {object:hole} here.
on the object, on the verbs tab, add IE: "crawl".
for the value, change to "Run script":
MoveObject (player, dining room)
This will move the player to the room "dining room", or where ever the other end of the hole goes to.
then test to make sure it works.


I have a game: https://textadventures.co.uk/games/view/ytxcboq5uug1zlu4q6sbvw/the-house-on-the-hill where the exits are first: north, south, east and west, then, after you go through, the exit, both ways, changes to the connecting room.


You might be a little confused because of Quest's terminology.

I know exits and rooms are essentially just objects

Not quite true. Rooms are objects, but exits are not. Objects, exits, turnscripts, and commands are the 4 different types of elements. Although a lot of times, the documentation says "object" when it means "element". For example, an objectlist is a list of elements, and the function GetObject can be used to get any kind of element.

In any case… within a string, you can use the text processor to create links.

  • {object:bucket} will create a link to an object, which displays a list of verbs when clicked.
  • {exit:exit126} will create a link to an exit, which will go in that direction when clicked.

If there is an object named bucket then the expression ObjectLink (bucket) just generates the string "{object:bucket}"… so

msg {"Move the " + ObjectLink(boxes) + "."}

is exactly the same as (but marginally slower than):

msg {"Move the {object:boxes}."}

In general, the only real reason to use ObjectLink is if you have the object in a variable (because {object: only works with the name of an object).

Note that for both {object: and {exit:, you need to give the name of the object or exit. In most cases you don't know the name of an exit; Quest gives them names like exit1, exit2, exit3, and so on, and doesn't display them in the editor. So if you want to create a manual exit link, you will need to give it a name.

The other alternative is to use the functions GetExitByName and GetExitByLink - which are horribly misnamed, because they get the name of an exit, not the actual exit, and because GetExitByName looks up an exit by alias, not by name.

Here's some examples:

msg ("A big door leads {exit:" + GetExitByLink (lounge, kitchen) +"} to the kitchen.")

n this case, GetExitByLink (lounge, kitchen) gets the name of the exit leading from the lounge to the kitchen. This will generate a string like A big door leads {exit:exit23} to the kitchen., which will then be displayed to the player as something like:

A big door leads north to the kitchen.

using the alias of exit23.

Similarly, you can use GetExitByName, in which case the expression would look like "A path leads {exit:" + GetExitByName (garden, "north") + "}."
This finds an exit heading north from the garden. I think you have to use the exit's alias (so north or northeast, but not n or ne). But I have never actually tested this, so I don't know if it might work.

Alternatively, you might want to use a command link. For example:

msg ("It might be a good idea to {command:go north} from here.")

This isn't an object or an exit, it's just a piece of text. It doesn't check if the exit is accessible. When the player clicks on the command, it will type "go north" in the command bar and hit enter, exactly as if the player typed it directly.

In all of these, you can add a second part to the directive. For example: {object:name of object:some other description}. In this case, the link will act as if the player clicked on the object name of object (and the link will disappear if they can't see that object), but the text shown on the link will be some other description instead of the object's name or alias.

Hope that all makes sense to you.


Thank you MrAngel - that was exactly what I needed. I've got to be honest I tried to learn the basics from watching YouTube tutorials but there is a distinct lack of content for Quest and those that are there seem to have taught me the more complicated way round of doing things. I might have to create my own set of video tutorials when I've finished up my game and share what I've learned. Your {command: go north} was just the thing for my game; really simple and effective.

Also, thanks DarkLizerd for your suggestion I will definitely use your suggestion elsewhere in the game.


Log in to post a reply.

Support

Forums