Checking for Specific Flag...[UNSOLVED]

Anonynn
02 May 2017, 02:17

Is there a check if any objects in a room carry a particular flag? Liquidsource is the flag.

Like (GetScopeSurroundings.liquidsource=True) {
}

Or something like that? I might make it a command or something. Any ideas?

Anonynn.


Pertex
02 May 2017, 13:58

Any object? objects in container, too? Or objects in the inventory when the player is in that room?


hegemonkhan
02 May 2017, 14:50

here are built-in objectlist get'ers (pick the one you want, I myself am still confused as to the difference between some of them and/or in what they mean, laughs, so good luck):

http://docs.textadventures.co.uk/quest/scopes.html

and an example of using them:

foreach (object_variable, YOUR_CHOSEN_SCOPE (POSSIBLE_PARAMETER_REQUIRED_FOR_IT)) {
  if (HasAttribute (object_variable, "liquidsource")) {
    // scripting
  }
}

// or:

foreach (object_variable, YOUR_CHOSEN_SCOPE (POSSIBLE_PARAMETER_REQUIRED_FOR_IT)) {
  if (GetAttribute (object_variable, "liquidsource") = DESIRED_VALUE) { // the ' = DESIRED_VALUE' isn't needed if it's a Boolean Attribute, as it'll automatically check if it's 'true' or if you have 'not' in front of the 'GetAttribute', it'll check if it's 'false (not true)'
    // scripting
  }
}

Dcoder
02 May 2017, 15:03
foreach (object, GetAllChildObjects (room))  {
  if (HasAttribute(object, "liquidsource"))  {
    msg (object)
  }
}

Or something similar to that.


Anonynn
02 May 2017, 22:40

Yes. On one particular object the player carries with them, when a certain verb on the item is clicked, I would like it to check all objects in that room for the "liquidsource" flag. ^_^ Thank you for all the responses!

Anonynn.