[size=18]TriviaMod v2.3.0 — Advanced Trivia Script for PtokaX[/size]
Hi everyone,
I am releasing
TriviaMod v2.3.0, a heavily improved version of the classic Trivia script originally written by
chill, then extended by
NRJ (Quiz 1.6). This release is the result of a long rework session covering bugs, encoding, translation, and a set of new features.
[size=14]Compatibility[/size]- PtokaX 0.4.x.x / 0.5.x.x
- Lua 5.1 / 5.2 / 5.3 / 5.4
- Windows (Windows-1252 encoding)
[size=14]What is new compared to the original v1.02d[/size]Core fixes- Fixed math.randomseed() crash on Lua 5.4 (os.clock() returns a float — wrapped with math.floor())
- Fixed unclosed string in Commands.lu (ShowReport, line 382) that prevented the script from loading at all
- Fixed OnExit() crash when script failed to fully load
- Fixed questions.txt path (was pointing to wrong directory)
- Fixed duplicated line in !trivmytop stats display
Question file flexibility- SplitLine() now auto-detects the number of separators per line — all three formats are handled transparently:
{Category} Question *Answer (no * after brace)
{Category}*Question *Answer (standard format)
{Category} *Question *Answer (extra space, also works)Lines with only one separator no longer get silently dropped when quesmode=1.
- GetQuestion() extracts the {Cat} category directly from the question text when the Category field is empty.
Visual improvements- All question display modes (QuestionMode=1, showquestion 1/2/3) now use the same framed layout with separators for a consistent look.
- Correct answer reveal, timeout, and hints are all framed.
- Startup version printed to the PtokaX console.
New commands- !trivskip — skip current question (available to players)
- !trivconfskip — enable/disable skip (admin)
- !trivbreakskip — skip current break (admin)
- !trivgrades — show the full rank table with point thresholds
Rank system- 10 configurable ranks (tRankMembers) with a fixed point interval (RankInterval).
- Default ranks: Novice / Apprentice / Curious / Scholar / Confirmed / Expert / Quiz Master / Sage / Legend / Grand Champion
- Rank displayed in !trivscore and !trivmytop.
- Automatic rank-up announcement when a player reaches a new rank.
Team mode (optional)- Activate by filling tCfg.Teams with nickname prefixes:
tCfg.Teams = { "[RED]", "[BLUE]", "[GREEN]" } - Players are automatically assigned to a team based on their nickname prefix — no login command required.
- Separate team score table (TeamScores.tbl), persisted to disk.
- !trivteamscore — show team ranking with rank badges.
Team multiplier — System C- Players contribute to their team score with a multiplier based on their personal rank tier:
Beginner (ranks 1-3) x1.0 — normal points
Intermediate (ranks 4-6) x1.5 — 50% bonus
Elite (ranks 7+) x2.0 — double points - Multiplier announced after each correct answer.
- Team rank-up notified when the team crosses a new threshold.
- All coefficients are configurable in settings.lu (tTeamMulti).
[size=14]Installation[/size][list=1]
- Extract the ZIP into your PtokaX scripts folder.
- The structure must be:
scripts/
Trivia_Mod.lua
TriviaMod/
settings.lu
questions.txt
Data/
Functions/- Edit TriviaMod/settings.lu to set your bot name, profiles, command prefix, rank names, team prefixes, etc.
- Load Trivia_Mod.lua from the PtokaX script manager.
- Check the PtokaX console — you should see: TriviaMod v2.3.0 loaded.
[size=14]Question file format[/size]The script accepts three equivalent formats:
{Category} Question text *Answer
{Category}*Question text *Answer
{Category} *Question text *AnswerMultiple valid answers are separated by additional
* characters:
{Category} *Question *Answer1 *Answer2The
{...} category tag is optional. Lines without it are read as plain
Question *Answer entries.
[size=14]Commands summary[/size]Players!trivhelp — help
!trivmytop — your personal stats and rank
!trivscore — top scorers
!trivstats — top N player stats
!trivtoptime — top by average response time
!trivtopanswers — top by correct answer count
!trivtopstreak — top by streak
!trivskip — skip current question
!trivhint — request a hint
!trivreport — report an error in a question
!trivgrades — show rank table
!trivteamscore — show team ranking (if team mode active)
!login / !logout — join / leave the game (PM mode)Admin!trivstart — start the quiz
!trivstop — stop the quiz
!trivpause — announce a break
!trivcontinue — resume after break
!trivbreakskip — skip current break
!trivquestion N — jump to question number N
!trivconfskip — toggle question skip on/off
!trivhint — toggle hints on/off
!trivchangemode — toggle sequential/random mode
!trivmain / !trivpm — switch main chat / PM mode
!trivaddquestion — add a question live
!trivshowreport — show error reports
!resetscores — reset all scores[size=14]Credits[/size]- Original script : chill
- Quiz 1.6 rework : NRJ
- v1.02d base : TriviaMod team
- v2.x rework : Raphaël (FR)
Based on the original thread: http://mydc.ru/topic1377.html
[size=14]Feedback[/size]Please report any bugs, suggestions or question file issues in this thread.
Tested on PtokaX 0.5.x with Lua 5.4 on Windows.
Enjoy the quiz! :)