Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adventure score screen and conditional question polish #81

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
ddae440
Add conditional question text
Dec 14, 2023
ce36a9f
Hide updates on tab in player
Dec 14, 2023
d38ede7
Update creator's guide
Dec 14, 2023
16bba1f
merge in master
cayb0rg Dec 18, 2023
7c3f9b6
Fix unreachable destinations checker
cayb0rg Dec 18, 2023
9e9b2d9
Merge branch 'master' of github.com:ucfopen/adventure-materia-widget …
cayb0rg Dec 18, 2023
ecba592
remove testing stuff
cayb0rg Dec 18, 2023
2165dcf
Reposition advanced question button and remove unnecessary continue s…
cayb0rg Dec 18, 2023
675e704
Fix styling in creator and choose question based on most recently acq…
cayb0rg Dec 19, 2023
b586860
Fix choosing question with most recent item
cayb0rg Dec 19, 2023
933ca5f
Fix multiple questions for new widgets
cayb0rg Dec 19, 2023
31b8254
Fix player skipping base question on first visit and null reference
cayb0rg Dec 19, 2023
342293a
Fix question deletion, implement default/conditional question selecti…
cayb0rg Jan 5, 2024
3729e14
Small creator tweaks. Significant rework of score screen. WIP.
clpetersonucf Feb 20, 2024
46b6c29
Enhanced support for hotspot display in score screens
clpetersonucf Feb 20, 2024
5456fb3
Added logic to simulate item acquisition/removal more accurately in s…
clpetersonucf Feb 22, 2024
1504578
tweaks to conditional questions UI. Support for conditional question …
clpetersonucf Feb 28, 2024
10272fd
Reword advanced question editor
cayb0rg Mar 13, 2024
133967b
Tweaks to conditional question logic. Final node visit now supports c…
clpetersonucf Mar 15, 2024
56625ac
Reworks wording of condi question dialog. Score screen fix for condi …
clpetersonucf Mar 19, 2024
90381c1
Updated scoring logic. Added older qset warning in score screen.
clpetersonucf Mar 20, 2024
f09a8b4
style polish. reworking required items UI. bug fix for rando answers.
clpetersonucf Mar 22, 2024
317a6a8
Adds option to hide required items for individual answers. Retired it…
clpetersonucf Mar 26, 2024
e5b9371
Addl tweaks to responsive node-creation layout, unselectable answer o…
clpetersonucf Mar 26, 2024
0544694
Added text for no items in player inventory. Added placeholder text i…
clpetersonucf Mar 27, 2024
891c27d
Style fixes. Bug fix with provisioning items in player.
clpetersonucf Mar 27, 2024
11bf30a
qset compatibility fixes
clpetersonucf Apr 10, 2024
2bf84a3
Better handling of blank preview nodes on score screen
clpetersonucf Apr 11, 2024
2b05e50
Adds backwards compatibility fallback
clpetersonucf Apr 11, 2024
71567de
Adjustments to required items display in player
clpetersonucf Apr 24, 2024
3ccd4bc
Resolving merge conflict with target branch
clpetersonucf Apr 24, 2024
6080e6f
adds micromarkdown support to score screen
clpetersonucf May 7, 2024
690815b
Adds partial string detection for short answer responses
clpetersonucf May 7, 2024
6f13b05
Make question selection intuitive and clear
cayb0rg May 7, 2024
279e64e
Merge branch 'feature/score-screen-and-fixes' of github.com:clpeterso…
cayb0rg May 7, 2024
8a6471a
Remove logs
cayb0rg May 7, 2024
c3f7003
Fix rename
cayb0rg May 7, 2024
cc0eae7
Fix required item range in player
cayb0rg May 7, 2024
80bb474
Merge branch 'feature/score-screen-and-fixes' of github.com:cayb0rg/a…
cayb0rg May 7, 2024
49840cc
Fixes micromarkdown addition to scorescreen. Enforces unique ids in s…
clpetersonucf May 7, 2024
8205917
Fix auto scroll in advanced question editor
cayb0rg May 7, 2024
0acf37f
Fixes for special character matching in creator to prevent duplicate …
clpetersonucf May 10, 2024
3577450
Fixed variable assignment associated with prior commit
clpetersonucf May 10, 2024
f20072e
Fix storage of last selected question/shown questions and make questi…
cayb0rg May 13, 2024
926c0cb
Add conditional question service to score screen
cayb0rg May 14, 2024
e4cc931
Change how recency is calculated
cayb0rg May 14, 2024
ba3125c
Remove recency function from score screen
cayb0rg May 14, 2024
6b0bdca
Fix non-conditional question responses in scorescreen
cayb0rg May 15, 2024
573381b
Fix calls to inventoryService in player
cayb0rg May 15, 2024
27153c0
Merge pull request #1 from cayb0rg/feature/score-screen-and-fixes
clpetersonucf May 17, 2024
4f1a68b
Fixed missing score value in score screen. Updated MWDK to 3.0.2.
clpetersonucf May 21, 2024
0430239
Merge branch 'master' into feature/score-screen-and-fixes
clpetersonucf May 21, 2024
a54d5f8
Significant tweaks to short answer matching. Added most significant m…
clpetersonucf May 22, 2024
50064b0
Removes console logs
clpetersonucf May 22, 2024
ae813e2
Adds checkInventory helper function available to scope in player
clpetersonucf May 23, 2024
df9d18b
Fixed missing param in nodeVisitedCount reference in score screen. Re…
clpetersonucf May 24, 2024
1305287
Temporarily disabled unreachable nodes validation pending re-review
clpetersonucf May 29, 2024
8672367
Adjusts condi question help text wording. Fixes blank node rendering …
clpetersonucf Jun 12, 2024
a3c9148
fix to short answer matches not correctly recycling response value fo…
clpetersonucf Jun 13, 2024
b1fd586
Fixed short answer match whitespace trim to retain symbols
clpetersonucf Jun 13, 2024
86e2b14
Reworks bridge node rendering. Bridge nodes are always visible, style…
clpetersonucf Jun 18, 2024
88c5e17
Fix for meltdown caused by adding in-between nodes along existing nod…
clpetersonucf Jun 18, 2024
71f6c26
final score minimum value now 0, not 1
clpetersonucf Jun 18, 2024
7424564
Removed console log. Minor button tweaks.
clpetersonucf Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/_guides/creator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
Expand Down
61 changes: 39 additions & 22 deletions src/_score/score_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
}
}
}
Expand Down Expand Up @@ -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 = [];
Expand All @@ -116,28 +133,28 @@ 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;
}
}

// 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'],
Expand Down
Loading
Loading