[Mod] Quiz - Play Challenge [yaml]

Post Reply
snowyu
Member
Posts: 25
Joined: Mon Jun 07, 2021 06:42
GitHub: snowyu

[Mod] Quiz - Play Challenge [yaml]

by snowyu » Post

This mod requires players to answer question before they can play. If you answer correctly, you will get a award and continue to play, otherwise you will not be able to play.

Image

Players are required to answer questions at regular intervals(`idleInterval`), and the answer is correct to continue playing and get award.

When the game time(`totalPlayTime`) is up, kick the player out.

When logging in, check whether you have enough rest time, based on the recorded last time you left. If you do not have enough rest, you will be kicked out.

* Chat Commands to mange quiz(need quiz privilege)
* `loadQuiz`: reload quizzes from config file.
* `quiz <list>`: list all quiz
* `quiz <del> <Index|Id>`: delete a quiz
* `quiz <set> <Index|Id> title="Title" answer="Answer"`: edit/add the quiz
* `quiz reset [<playerName>]`: reset the game time of a player
* `quizAward <list>`: list all awards
* `quizAward <del> <Index|name>`: delete a award
* `quizAward <set> <Index|name> title="Title" [mod="default"] [count=<Number>]`: edit/add the award
* `saveQuiz`: save quizzes to config file.

`quiz_config.yml` in world folder:

Code: Select all

```yaml
# the revoke or grant privileges, defaults to "interact,shout"
grant: interact,shout
# totalPlayTime unit is minute, 0 means disable totalPlayTime
totalPlayTime: 30
# the rest time after playing, unit is minute, 0 means disable resetTime
restTime: 20
# Whether skip the question which has already be answered correctly.
# The number is answered count correctly to skip
skipAnswered: 1
# checkInterval unit is second
checkInterval: 5
# idleInterval unit is minute
idleInterval: 5
# the delay time to kick off, unit is second
kickDelay: 2
# the awards to give
awards:
  # the item name to give
  # minetest_game/mods/default/nodes.lua
  - id: coalblock
    # optional, for translation
    title: Coal Block
    # optional, the defaults to default mod
    mod: default
    # the item count, optional the defaults to 1
    count: 1
  - id: wood
    title: Apple Wood Planks
    count: 3
  - id: stone
    title: Stone
    count: 3
  - id: torch
    title: Torch
  - id: steel_ingot
    title: Steel Ingot
    count: 3
# the quiz list
quiz:
  - id: favorColor
    title: "What's my favor color?"
    answer: red
  - id: theYear
    title: "What's the year?"
    answer: 2021
  - title: "18/7=?"
    answer: "/^2%.%.%.+4/" # the lua string pattern: 2...4 (three dots and more)
  - title: "$calc=?"
    type: calc
    forceInt: true         # the result must be an integer
    answer: "(Nn*n+n)/(Nn-n)"
  - title: "What is the part of the plant that uses light to make food?"
    type: "select"
    options:
      - leaves
      - roots
      - stem
      - flowers
    answer: 1
```

Code: Select all

1. The `answer` supports the [Lua string pattern](https://www.lua.org/pil/20.2.html) enclosed in "/" slashes.(0.6.0)
2. The `answer` supports generate simple four arithmetic expressions randomly(`type: calc`)(0.7.0)
   * The division operation must be the last one
   * `forceInt` means the result of the expression is integer only.
   * `N`: generate a none-zero number(1-9)
   * `n`: generate a number(0-9)
   * `[1-39]`: the set(range) of numbers(from 1 to 3) and number 9
   * `[+-*/]`: the set(range) of operations.
     * Note: The division operation must be the last!
3. Multiple choice questions supported(`type: select`)(0.8.0)
   * `options`: list items to be selected.
   * `answer`: the sequence number of the correct option.
     * **Note**: must sort from small to large
Source: https://github.com/snowyu/minetest-quiz
Download: https://content.minetest.net/packages/snowyu/quiz
License: MIT
Attachments
screenshot_20210622_175223.png
screenshot_20210622_175223.png (70.91 KiB) Viewed 1442 times
Last edited by snowyu on Sun Jul 24, 2022 13:32, edited 1 time in total.

Harry Wood
New member
Posts: 2
Joined: Fri Jul 30, 2021 17:40

Re: [Mod] Quiz - Play Challenge [yaml]

by Harry Wood » Post

This looks like it could be useful for making my 5 year old's minetest addiction a bit more educational! (I found out about it via the 'List of Mods for Education' linked here)

Can anyone help me get it working though? Probably a simple thing I'm not understanding. With it enabled, it says it has unsatisfied dependencies 'yaml' and 'formspecs'. So I searched for a mod called 'yaml', installed and enabled it. So far so good. But I can't find a mod called 'formspecs'. I read somewhere that formspecs is built in. What do I need to do about formspecs to make this work?

Also is there an easier way to automatically install all of a mod's dependencies? When I installed "mineclone 2" it seemed to automatically install and enable a whole bunch of mods.

c56
Member
Posts: 307
Joined: Wed Apr 21, 2021 03:05
GitHub: tigercoding56
In-game: bm5 or bemo5 also sell_her_on55

Re: [Mod] Quiz - Play Challenge [yaml]

by c56 » Post

Harry Wood wrote:
Sun Jan 16, 2022 11:46
This looks like it could be useful for making my 5 year old's minetest addiction a bit more educational! (I found out about it via the 'List of Mods for Education' linked here)

Can anyone help me get it working though? Probably a simple thing I'm not understanding. With it enabled, it says it has unsatisfied dependencies 'yaml' and 'formspecs'. So I searched for a mod called 'yaml', installed and enabled it. So far so good. But I can't find a mod called 'formspecs'. I read somewhere that formspecs is built in. What do I need to do about formspecs to make this work?

Also is there an easier way to automatically install all of a mod's dependencies? When I installed "mineclone 2" it seemed to automatically install and enable a whole bunch of mods.
use minetest game (which should be called modding base ) and enable yaml and this mod or if using another game just get the formspecs mod from the minetest game directory and put it into the mods folder
this is a signature not a place to post messages also if i could change my username i would change it to sell_her_on55

User avatar
Blockhead
Member
Posts: 1602
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Quiz - Play Challenge [yaml]

by Blockhead » Post

The mod name 'formspecs' usually refers to sorcerykid's ActiveFormspecs mod. Otherwise, formspecs are built into the engine and don't need to be specified in mod.conf. Ignore c56's advice, there is no formspecs mod in Minetest Game. At a glance at the source code, it looks like this mod does use ActiveFormspecs, so you should install it from the above link.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

snowyu
Member
Posts: 25
Joined: Mon Jun 07, 2021 06:42
GitHub: snowyu

Re: [Mod] Quiz - Play Challenge [yaml]

by snowyu » Post

Yes, The `formspecs` is the sorcerykid's ActiveFormspecs mod.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests