diff --git a/package.json b/package.json index 46e6c4d7..9c41f908 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "version": "2.4.1", "dependencies": { - "materia-widget-development-kit": "^3.0.1", + "materia-widget-development-kit": "^3.0.2", "micromarkdown": "^0.3.0" }, "scripts": { diff --git a/src/_guides/assets/create_widget_adventure_conditional_questions.png b/src/_guides/assets/create_widget_adventure_conditional_questions.png new file mode 100644 index 00000000..f126bfd4 Binary files /dev/null and b/src/_guides/assets/create_widget_adventure_conditional_questions.png differ diff --git a/src/_guides/assets/create_widget_adventure_conditional_questions_items.png b/src/_guides/assets/create_widget_adventure_conditional_questions_items.png new file mode 100644 index 00000000..4f58431f Binary files /dev/null and b/src/_guides/assets/create_widget_adventure_conditional_questions_items.png differ diff --git a/src/_guides/creator.md b/src/_guides/creator.md index 2257c2a5..9a14e5b2 100644 --- a/src/_guides/creator.md +++ b/src/_guides/creator.md @@ -173,6 +173,16 @@ For any destination type besides Hotspot, selecting the **Add Media** button cha If you choose to upload an image, the image uploader will be displayed, where you can upload images from your computer, or select an image you've previously uploaded to Materia. Once you've selected an image or video, you can use the **Swap with Question** button below the media to switch the arrangement of the image and question text. Narrative and End Point destinations allow you to choose between vertical as well as horizontal arrangements. Select **Change Media** to choose a different image or video. +### (Advanced) Conditional Text Based on Number of Visits +You have the option of creating different question text each time a player visits a destination. Click on the "Advanced Question Editor" at the top right of the node creation screen to open the editor. + +![conditional questions](assets/create_widget_adventure_conditional_questions.png "conditional questions") + +1. Add question text +2. Change required number of visits + +It will always display the question text with the most required number of visits met. For example, if a player has visited the node 2 times, it will display the second question above. If a player has visited the node 6 times, it will display the third question above. + ## Inventory System ## Optionally, you can choose to use the inventory system. The inventory system allows you to give the player items or remove items from the player's inventory for each destination they visit. @@ -283,6 +293,13 @@ The advanced options allow you to set the required item amount to be within a sp 2. Set the maximum number the player can have of this item to select this answer. 3. (Default) Set the maximum to have no cap. +### (Advanced) Conditional Question Text Based on Items +Once you have created items, an option will appear in the Advanced Question Editor to require items for each question text. You can require players to have certain items in their inventory in order to see different questions by clicking on the "Edit Required Items" button. This menu will operate similarly to the required items for answers from above. + +![conditional questions](assets/create_widget_adventure_conditional_questions_items.png "conditional questions") + +It will always display the question text with the most requirements met. For example, if the first question requires the player to have a hat, but the second question requires the player to have a hat AND a vinyl, it will display the second question if the player has both. + ### Example Tree Using Inventory System ### ![adventure tree with items](assets/create_widget_adventure_tree_with_items.png "adventure tree with items") diff --git a/src/_score/score_module.php b/src/_score/score_module.php index a1113407..56447791 100755 --- a/src/_score/score_module.php +++ b/src/_score/score_module.php @@ -29,16 +29,33 @@ public function check_answer($log) continue; } - # make sure we have the right qset item that matches the provided log, return associated finalScore - if (trim($log->text) == trim($item['questions'][0]['text'])) + # newer qsets (post- custom score screen will provide the node id as the log's item id) + # in older qsets, item id will always be 0 for FINAL_SCORE_FROM_CLIENT log types + if ($log->item_id) { - if (isset($this->inst->qset->data['options']['scoreMode']) && $this->inst->qset->data['options']['scoreMode'] == 'Non-Scoring') + if ($log->item_id == $item['options']['id']) { - return 100; + if (isset($this->inst->qset->data['options']['scoreMode']) && $this->inst->qset->data['options']['scoreMode'] == 'Non-Scoring') + { + return 100; + } + else + { + return $item['options']['finalScore']; + } } - else + } + else { + if (trim($log->text) == trim($item['questions'][0]['text'])) { - return $item['options']['finalScore']; + if (isset($this->inst->qset->data['options']['scoreMode']) && $this->inst->qset->data['options']['scoreMode'] == 'Non-Scoring') + { + return 100; + } + else + { + return $item['options']['finalScore']; + } } } } @@ -78,23 +95,23 @@ protected function details_for_question_answered($log) $score = $this->check_answer($log); return [ + 'id' => $log->item_id, 'data' => [ $this->get_ss_question($log, $q), - $this->get_ss_answer($log, $q) + $this->get_ss_answer($log, $q), + $log->value ], - 'data_style' => ['question', 'response', 'answer'], + 'data_style' => ['question', 'response'], 'score' => $score, 'feedback' => $this->get_feedback($log, $q->answers), 'type' => $log->type, 'style' => $this->get_detail_style($score), - 'tag' => 'div', 'symbol' => '%', 'graphic' => 'score', 'display_score' => false ]; } - protected function get_score_details() { $details = []; @@ -116,16 +133,21 @@ protected function get_score_details() break; case Session_Log::TYPE_FINAL_SCORE_FROM_CLIENT: - $destination_table[] = [ - 'data' => [$log->text], - 'data_style' => ['node_text'], + $details[] = [ + 'node_id' => $log->item_id, + 'data' => [ + $log->text, + $this->check_answer($log) + ], + 'data_style' => ['text', 'score'], 'score' => $this->check_answer($log), 'type' => $log->type, - 'style' => 'single_column', - 'tag' => 'p', + 'style' => 'final_score', 'symbol' => '%', - 'graphic' => 'none', - 'display_score' => false + 'graphic' => 'score', + 'display_score' => false, + 'older_qset' => $log->item_id == 0 && $log->text != 'Blank Destination! Be sure to edit or remove this node before publishing.' ? true : false, + 'blank_node' => $log->item_id == 0 && $log->text == 'Blank Destination! Be sure to edit or remove this node before publishing.' ? true : false, ]; break; } @@ -133,11 +155,6 @@ protected function get_score_details() // return an array of tables return [ - [ - 'title' => 'Where did you end up?', - 'header' => [], - 'table' => $destination_table, - ], [ 'title' => 'Responses:', 'header' => ['Question Score', 'The Question', 'Your Response'], diff --git a/src/creator.html b/src/creator.html index 078c555f..48d343a4 100644 --- a/src/creator.html +++ b/src/creator.html @@ -166,7 +166,7 @@

Select or Upload an Icon

class="important-button" ng-click="uploadIcon()">Upload Icon @@ -472,7 +472,7 @@

Just a sec!

Careful! Deleting this destination will delete all child destinations, as well as its associated parent's answer. Are you sure?

+ ng-click="deleteNode()">Do It @@ -553,21 +553,22 @@

End Point for {{ integerToLetters(editedNode.id) }} {{ editedNode.customLabel ? ': ' + editedNode.customLabel : ''}}

-
-
+
+
- +
@@ -677,13 +678,27 @@

ng-repeat="match in answer.matches" ng-click="removeAnswerMatch($index, $parent.$index)">{{match}}

-
- - - - +
+

Matching Options

+

The response entered by the user will be compared to each possible answer provided above. By default, matches are not case-sensitive. Whitespace will always be ignored.

+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
-
+

Required Items for Answer

@@ -767,7 +781,7 @@

Required Items for Answer

Player must not have this item.

- +
@@ -790,21 +804,20 @@

Required Items for Answer

- -
- -
- - +
- +
+
+ + +
+
+ + +
+
-
@@ -1040,7 +1053,7 @@

Required Items for Hotspot

- +
@@ -1063,7 +1076,7 @@

Required Items for Hotspot

- +
@@ -1114,239 +1127,7 @@

Required Items for Hotspot

- -
- -
-
-
-

Items for {{integerToLetters(editedNode.id)}}

- -
- Select an item via the drop-down, then choose whether the item will be given to the player or taken from them. -

{{invalidQuantity}}

-

{{invalidMaxQuantity}}

-
-
-
-
-
-
- - -
-

Give Player Items

-
-
-
    -
  • -
    -
    - -
    -
    -
    - {{inventoryItems[getItemIndex(item)].name}} -
    -
    -
    - -
    - Quantity - -
    -
    - -
    -
    - - -
    -
  • -
-
-
-
-
-
- - -
-

Take Player Items

-
-
-
    -
  • -
    -
    - -
    -
    -
    - {{inventoryItems[getItemIndex(item)].name}} -
    -
    -
    -
    - Quantity - -
    -
    - -
    -
    -
    - - -
    -
    - - -
    -
    -
  • -
-
-
-
-
-
-
- -
-
-
- - {{inventoryItems[getItemIndex(selectedItem)].name}} -
- -
-
-
- - {{item.name}} -
-
-
- - -
-
- - -
-
-
- -
-
-
-

Required Items for Answer

- -
-

The player must have these items in their inventory to select this answer.

-

{{invalidQuantity}}

-

{{invalidMaxQuantity}}

-
- -
-
-
-
- -
-
-
- - {{inventoryItems[getItemIndex(selectedItem)].name}} -
- -
-
-
- - {{item.name}} -
-
-
- -
-
-
- - -
-
-
+
@@ -1382,7 +1163,7 @@

Required Items for Answer

ng-class="{'invalid' : !finalScoreForm.$valid}" ng-model="finalScore" placeholder="100" - min="1" + min="0" max="100" /> % @@ -1554,6 +1335,10 @@

Take Player Items

-->
+ + + +

Conditional Question Text

+

Conditional Question

+

Conditional Question

+

Conditional Narrative Text

+

Conditional End Text

+
+

Choose to display different narratives based on the number of times the player has visited this destination.

+

Choose to display different narratives based on the player's number of visits to this destination and/or what items they have in their inventory.

+

+ How the widget chooses which option to display: If a player meets the requirements for more than one option, the option that has not yet been displayed will be chosen. If more than one option meeting the criteria hasn't been displayed yet, the option with the most required items and visits will be selected. +

+

{{invalidRequiredVisits}}

+
+

{{invalidRequiredVisits}}

+ +
+ + +
+

Inventory Items

+
+

You don't have any items yet.

+

Once you receive an item, it'll appear here.

+
NEW! @@ -120,7 +124,6 @@

Count

aria-label="Welcome to Adventure. Now playing: {{title}}" aria-describedby="tutorial-content" tutorial-focus-manager> -