Code sample - How to exclude an object from being listed when the command is GET/TAKE ALL

To exclude an object from TAKE/GET ALL

Created an attribute called 'not_all' for the object. (NOTE: You can use a Boolean and set it to "True" to maintain a professional appearance. You can also just leave it as an empty string. Either, way the code remains the same. (Thanks Pixie!))

Altered script for the command 'take':

anything_to_take = false
foreach (obj, object) {
  if (not HasAttribute(obj, "not_all")) {
    DoTake (obj, multiple)
    anything_to_take = true
    //this signals the presence of an object that is included in TAKE ALL
if (not anything_to_take) {
  ///Meaning there is not an object that would be included in TAKE ALL present
  msg ("There is no all to take.")

And that's it!

If there is nothing to get, it will print, "There is no all to take."

Otherwise, it will take everything marked 'can be taken', printing each object's takemsg, just like it normally would.

Log in to post a reply.