After Inspection Script

I'm trying to make it so if you investigate something, you receive a text, however if you investigate something else before that, you will get a different text. Any idea how to do this exactly?


the concept is setting indicators/flags (Attributes) upon doing some action (on/to something) and then checking (via the 'if' Script) those indicators/flags (Attributes) to determine what action is done (on/to that something else).

an example (using a custom 'is_investigated' Boolean Attribute):

<object name="chest_1_object">
  <attr name="alias" type="string">chest 1</attr>
  <attr name="is_investigated" type="boolean">false</attr> // the Boolean Attribute's Value starts as 'false'
  <attr name="displayverbs" type="listextend">investigate</attr>
  <attr name="investigate" type="script">
    chest_1_object.is_investigated = true // upon investigating (clicking on our custom 'investigate' Verb/Script Attribute button during game play) the chest 1, the Boolean Attribute's Value is changed/set/re-set to now being 'true'
    msg ("You investigated chest 1")
  </attr>
</object>

<object name="chest_2_object">
  <attr name="alias" type="string">chest 2</attr>
  <attr name="displayverbs" type="listextend">investigate</attr>
  <attr name="investigate" type="script">
    // we check (the 'if' Script) the Boolean Attribute's Value (acting as our condition), to determine what action is done:
    if (chest_1_object.is_investigated) { // if (chest_1_object.is_investigated = true) {
      msg ("since, you investigated chest 1, you're now able to open chest 2")
    } else { // if (chest_1_object.is_investigated = false) {
      msg ("since you have NOT investigated chest 1, you're NOT able to open chest 2")
    }
  </attr>
</object>

<verb>
  <property>investigate</property>
  <pattern>investigate</pattern>
  <defaultexpression>You can't investigate that!</defaultexpression>
</verb>

  1. Do interaction #1 --> set flag 'onedone' on 'player' (or any other object)
  2. Do interaction #2 --> If 'player' has flag name 'onedone', then run script A. Else run script B.

Thanks guys.


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

Support

Forums