Is there a way to print a list of objects in room, but only if they have a certain flag or so?

Curt A. P.
07 Dec 2017, 16:26

Hi guys,
just another question. I hope there's a way.

My goal is to give in object a 'throw' or verb which will print a list of objects that can get targeted.

Like:

>Throw marple

Throw at which target?

  1. Cornelius
  2. Laughing Goblin
  3. Window

You throw the marple at Cornelius. The goblin laughs louder.

I hope it's possible to make it look like this. I thought about using the flag "throw_target" and if I throw a object a list of all objects in the room with the "throw_target" flag appears. This would become very handy for many future usages in my imagination. Any solutions?

Thx, Curt


The Pixie
07 Dec 2017, 17:22

Yes, you can do exactly that. You can then get your list of targets like this:

targets = FilterByAttribute(ScopeVisibleNotHeld, "throw_target", true)
ShowMenu("Throw at which target?", targets, true) {
   ...

Curt A. P.
08 Dec 2017, 00:56

Okay, this is nice and those Scope seems very useful, but I don't get it working.

Error running script: Error compiling expression 'ScopeVisibleNotHeld': Unknown object or variable 'ScopeVisibleNotHeld'

I tried to use it on easier scripts, but can't figure out how this ScopeVisibleNotHeld should work as quest seems not recognizing it.


The Pixie
08 Dec 2017, 08:19

Sorry, my bad; I forgot the brackets after the scope. Should be:

targets = FilterByAttribute(ScopeVisibleNotHeld(), "throw_target", true)
ShowMenu("Throw at which target?", targets, true) {
   ...

Curt A. P.
08 Dec 2017, 15:35

Oh, thanks you. This will help me so much... I already read about the other scopes now. Got excited...a bit...
Thx, Curt