ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Object hyperlinks and contextual menu - How To?

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Object hyperlinks and contextual menu - How To?

Postby leokhorn » Tue May 09, 2017 5:54 pm

Hello all! I've discovered Adrift has a way to underline interactive items in the text AND provide a contextual menu of actions for each.

Problem is, beyond activating this feature, I have no idea how to control it. New General Tasks I create do not appear in the menu, even though they apply to the item. Most default Tasks don't appear either. Get and Drop seem to be the only ones.

Is this meant to be used, or more of a WIP feature that never got any love and was left unfinished?

I've considered going with Quest 5 instead, since it offers exactly that feature, with explicit control (add/remove specific verbs), but Adrift has other features I would be cross to give up. Any help would be appreciated!
leokhorn
 
Posts: 4
Joined: Tue May 09, 2017 5:48 pm

Re: Object hyperlinks and contextual menu - How To?

Postby Denk » Wed May 10, 2017 3:38 pm

Hi leokhorn!

Though I have never used the feature before, I played around with it a bit and found that I was quite in control of what should appear in the menus. For instance I made "put the book on the shelf" only appear if I was holding the book. You can have other constraints such as variables etc.

Let us say you want to make "examine" appear in all menus. Then you make a new general task called e.g. "MENU-examine" and in the command-field you write: [examine] %objects% (note, it is important to write %objects% - NOT %object% when you want something to appear in a menu).

This task should never run but is only used to make examine appear in the menus. Thus you set the task priority to something higher than the real examine-task, e.g. 70000. It is also important that auto-fill priority is not zero.

Now "examine" should appear in all menus.

If you only want a verb to appear in some menus, e.g. if "read" should only appear for a book, you should simply add a restriction requiring that the referenced objects is this book.

If you are still having problems ask again - I can make a small demo if you have a specific problem.
-----------------------------------------------------------------------------------------
Out now: The Royal Puzzle, The Way Home & The Dragon Diamond
-----------------------------------------------------------------------------------------
Denk
 
Posts: 42
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark

Re: Object hyperlinks and contextual menu - How To?

Postby leokhorn » Sat May 13, 2017 8:25 pm

Wow. I have no idea how you had the idea to create "menu-tasks" that way, but yeah, it does work! Did you stumble upon this or had hints from somewhere? Either way, thanks a lot for unlocking that magic for me ;)

I got Examine working, and even Open/Close with appropriate restrictions based on openable items. I haven't delved into complex cases yet. Will have to try "x on y" at some point.

Just now I also realized the right-click menu is made of verbs with no target. I'll have to see how to make some disappear maybe.


One thing I'm still struggling with is which words get underlined. I have a cardboard box item. It works if I call it "a/cardboard/box" (cardboard being the prefix), but only "box" gets underlined. If I call it "a/.../cardboard box" though, the whole thing is underlined but no menu appears, it just adds either word to the command line.
I get what I want by giving it all these names: "cardboard box", "box", "cardboard". Then it's underlined properly and both words give the menu when clicked. I just don't know if it's appropriate.


EDIT : currently struggling with "x on y" verbs, such as "put object on object".
I can see two possible goals:
* it lists one "put on" action per valid target for the given object. I click on "plate" and get "put plate on table" and "put plate on dresser" for example, but not "put plate on boot".
* It lists a single "put X on..." action which itself will list valid options in the output, waiting for a numeric choice to be made (àla Quest 5)

So far not getting anything appearing with "put %objects% on %objects2%". %object2% also doesn't work since that's how the default Task is set up.

Will update the post if I find something.
leokhorn
 
Posts: 4
Joined: Tue May 09, 2017 5:48 pm

Re: Object hyperlinks and contextual menu - How To?

Postby Denk » Sun May 14, 2017 8:45 pm

leokhorn wrote:I can see two possible goals:
* it lists one "put on" action per valid target for the given object. I click on "plate" and get "put plate on table" and "put plate on dresser" for example, but not "put plate on boot".
* It lists a single "put X on..." action which itself will list valid options in the output, waiting for a numeric choice to be made (àla Quest 5)

Though it is probably possible to make a "put X on..."-task which asks for a numerical choice, I believe the first goal is much simpler. However, I think you need to create one menu-task per target, e.g. one for the table and one for the dresser.

Here is how I do it: make a menu-task with the command line: "[put] %objects% [on table]" and through restrictions you ensure that the player is holding referenced objects and that the table and player are in the same location.
-----------------------------------------------------------------------------------------
Out now: The Royal Puzzle, The Way Home & The Dragon Diamond
-----------------------------------------------------------------------------------------
Denk
 
Posts: 42
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark

Re: Object hyperlinks and contextual menu - How To?

Postby leokhorn » Mon May 15, 2017 1:03 pm

Yeah, I managed to make it work that way last night. You only need one dedicated Task per target, which should be OK as long as the adventure doesn't contain many dozens of surfaces, containers and such.

At that point I've solved most issues about items, if sometimes in a roundabout way.

Remaining points to get a click-only game: directions and inventory access.

While directions ("north") are underlined, they don't auto-execute like menu options do. Could I somehow insert text-as-links in the output that just executes the link-text as a command?
Similarly, I can see how to keep printing links to [inventory], but it won't auto-execute either.


If it wasn't obvious yet, yes, I'm trying to see how close to "no-typing" I can get. I might be pushing Adrift to a place it's not meant to go, but I'm curious.
leokhorn
 
Posts: 4
Joined: Tue May 09, 2017 5:48 pm

Re: Object hyperlinks and contextual menu - How To?

Postby Denk » Tue May 16, 2017 1:32 pm

leokhorn wrote:While directions ("north") are underlined, they don't auto-execute like menu options do. Could I somehow insert text-as-links in the output that just executes the link-text as a command?
I do not think this is possible - you need an object or character to have a menu. However, you could create the directions as static objects with location 'everywhere' and make a menu-task: [go to] %objects%. In this way, if you click on "north" a menu will appear proposing "go to the north".

You could do something similar with "inventory", but it is probably not easy to make the word "inventory" visible at all times in a convenient way. I suppose you also want the word "look" available, and there could be other relevant words too. I think the right-click menu is the most suitable place for such words. You can get rid of unwanted elements in the right-click menu by setting auto-fill priority to zero in the relevant tasks. You could also put directions in the right-click menu.
-----------------------------------------------------------------------------------------
Out now: The Royal Puzzle, The Way Home & The Dragon Diamond
-----------------------------------------------------------------------------------------
Denk
 
Posts: 42
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark

Re: Object hyperlinks and contextual menu - How To?

Postby leokhorn » Tue May 16, 2017 1:36 pm

I really like the idea of putting these in the right-click menu! I'll give this a try.

Thanks for all the help so far :D
leokhorn
 
Posts: 4
Joined: Tue May 09, 2017 5:48 pm


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 1 guest

cron