Loading…
About Coded Trivia
Saves
Settings
Restart
Share
Generated session token e2b6cbb3ad1e04bee557509807fc40fcd87f84662ba9dc0db156b0f14b8d1a25
Confirm
Questions
Category
Any
General Knowledge
Entertainment: Books
Entertainment: Film
Entertainment: Music
Entertainment: Musicals & Theatres
Entertainment: Television
Entertainment: Video Games
Entertainment: Board Games
Science & Nature
Science: Computers
Science: Mathematics
Mythology
Sports
Geography
History
Politics
Art
Celebrities
Animals
Vehicles
Entertainment: Comics
Science: Gadgets
Entertainment: Japanese Anime & Manga
Entertainment: Cartoon & Animations
Difficulty
Any
Easy
Medium
Hard
Confirm
<<set $url to "https://opentdb.com/api.php?amount=">>\ <<set $url_cat to "">>\ <<set $url_dif to "">>\ <<set $url_que to "1">>\ <<set $cats to {}>>\ <<set $round to 0>>\ <<set UIBar.stow()>>\ <<set $score_correct to 0>>\ <<set $score_fail to 0>>\ <<if visited() == 1>><<getsession>>Generated session token $session_token<<else>>Resuming session $session_token<</if>> <<loadtdb>><<button 'Confirm'>><<create_tdb_url>><<goto 'game'>><</button>> !Questions <<textbox "$url_que" "1">> !Category * <label><<radiobutton "$url_cat" "" checked>> Any</label> <<for _i, _n range $cats.trivia_categories>>\ * <label><<radiobutton "$url_cat" _n.id>> _n.name</label><</for>> !Difficulty * <label><<radiobutton "$url_dif" "" checked>> Any</label> * <label><<radiobutton "$url_dif" "&difficulty=easy">> Easy</label> * <label><<radiobutton "$url_dif" "&difficulty=medium">> Medium</label> * <label><<radiobutton "$url_dif" "&difficulty=hard">> Hard</label> <<button 'Confirm'>><<create_tdb_url>><<goto 'game'>><</button>>
<<button 'Back to main menu'>><<goto 'Main'>><</button>> <<set $round to $round + 1>><<pullQuestion>> Round: $round / $url_que | Difficulty: $difficulty | Category: $category <b>$question</b> <<for _i, _n range $answers>><<capture _n>><<button '_n'>><<set $submitted to _n>><<goto 'check'>><</button>><</capture>> <</for>>
$question The correct anser was... $correct. You guessed $submitted. <<if $submitted == $correct>> You got it right. <<set $score_correct to $score_correct + 1>> <<else>> You got it wrong. <<set $score_fail to $score_fail + 1>> <</if>> <<if $round < $url_que>> <<button 'Next round'>><<goto 'game'>><</button>> <<else>> <<button 'Finish'>><<goto 'end'>><</button>> <</if>>
You got $score_correct out of $url_que correct. <<button 'Back to menu'>><<goto 'Main'>><</button>>
<<link 'About Coded Trivia'>> <<dialog 'About'>>\ Welcome to Coded Trivia! This is a simple trivia game. Questions sourced from the Open Trivia Database. Credits: Kaiser - Programming, concept ChapelR - Macros Mog - Initial tests, design suggestions Additional testers - WIP Designed with Twine engine and SugarCube template. Copyright © 2019 Kaiser (kaiser7@gmx.com) All rights reserved. <</dialog>> <</link>>
<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fcodedthoughts.github.io%2Ftrivia%2F&src=sdkpreparse&display=popup">Facebook</a> <a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fcodedthoughts.github.io%2Ftrivia%2F&text=Come play Coded Trivia!&via=technomancer7&hashtags=trivia">Twitter</a>