Scope is still beyond me

K.V.

Okay...

Here's what I (think) I've got figured out:

  1. I make a command.
  2. I use #object# (rather than #text#) in the pattern. (The object is in another room.)
  3. If I know the name of the specific parent object which the command will ALWAYS refer to, I simply enter the parent object's name in the Scope field.

Here's what I'd very much like to figure out:

  1. How do I make a command that will work for each and every object in the game without knowing the specifics up front?
    • I've tried setting up an attribute that equaled AllObjects(). I tried it as a script, a string, a list, a dictionary... I couldn't figure it out.
  2. It says I can use an attribute in the Scope field. How does that work? I can't get anything out of it...

My wish is to interact with any given NPC in any given room via two-way radio.

NPC, COME IN

That's the command I'm after. I'm trying not to clone or move anything around and only work with the ask attribute on each NPC.

OVER AND OUT would 'disconnect', placing the NPC back out of scope.

Is this possible?


I believe that Commands, with an '#object#' Parameter, it is just/only searching the parent room that you're in. So, you got to use the '#text#' Parameter instead, to handle it:

(you may be able to use the '#object#' Parameter, but I think the built-in stuff for it, will do the Command's 'default' String Attribute, upon not finding the Object within the parent Room Object of the Player Object, so you might have to change the built-in scripting for it... but maybe not too... not tested if your Command's scripting will over-ride the built-in scripting of it)

(this is also going to include extra coding, credit to Pertex as it's his coding, for handling the person entering in the 'alias', as usually this is what the person playing the game is knowing about, and not the Object's name, which is often hidden, used for the game maker's organization and structure)

<command name="example_command">
  <pattern>example #text_parameter#</pattern>
  <script>
    input_object_variable = GetObject (text_parameter)
    if (input_object_parameter = null) {
      foreach (object_variable, AllObjects ()) {
        if (object_variable.alias = text_parameter) {
          input_object_variable = object_variable
        }
      }
    }
    if (input_object_variable = null) {
      msg ("Your inputted Object doesn't exist in the game, wrong input, try again")
    } else {
      // your scripting for whatever you want to do with the inputted Object
    }
  </script>
</command>

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

Support

Forums