How to create a menu on using an item, preferably using the dropdown menu rather than code?

As title says:

I want to create a choice menu when using an item. A good example of this would be applying something to the player's body, such as suncream on a beach.

I'd want it to have multiple options (right arm, left arm, right leg, left leg, etc) but I also want it to not show (alternatively, telling the player that clothing is in the way would work too) options depending on whether the player is wearing certain clothing.
Example given: Give the option to put suncream on the player's back, but that option doesn't show provided your character is wearing anything that, well, conceals their back.

Currently my idea is to use flags for whether or not the bodyparts are concealed and have each clothing specify which part it conceals, and then work with that - have the choice menu checks which of these flags is on concealed or not, and then give the choices. Example given: A shirt conceals the back and stomach area, a bikini would not.

How exactly would I need to go about this when using the drop-down menus?

Apologies if this question is fairly rudimentary - albeit I have a general idea on what I want to make thanks to months of thinking, I only really started to try and work with Quest quite literally yesterday.

For context: I am making a TextAdventure (TA), on the windows desktop app.


If you're using the advanced wearables feature, there is already an option for 'slots' to represent body parts. The default use of this is to make sure that you can only wear multiple garments on the same location if they are different layers. But the same slots could probably work for body parts.

You could give your command a script something like:

bare_slots = NewStringList()
foreach (slot, Slots()) {
  if (GetOuterFor (game.pov, slot) = null) {
    list add (bare_slots, slot)
  }
}
if (ListCount (bare_slots) = 0) {
  msg ("You need to remove some clothes before applying sunscreen")
}
else {
  ShowMenu ("Where would you like to apply it?", bare_slots, true) {
    msg ("You apply sunscreen to your " + result + ".")
  }
}

In case it's not clear how this works:

  • Slots() returns a list of all slots for all clothes in the game
    • If you want to only allow certain options, you could replace Slots() with Split ("chest;back;legs;arms") or similar
  • GetOuterFor(character, slot) returns the outermost garment on a slot, or null if the slot is bare; so we check for null.
  • ShowMenu asks the player to choose one item from a list.
    • The option the player chooses will be in the variable result

Does that make sense?


It does! I'll have to figure out where to put that, but that shouldn't be too much of trouble. Thanks for the quicker-than-expected answer, mrangel!


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

Support

Forums