From 256eda1f7801f947021a05c5605e46a9cc686571 Mon Sep 17 00:00:00 2001 From: Daniel Korgel Date: Thu, 1 Jan 2026 12:46:03 +0100 Subject: [PATCH 1/5] Fixed path in player --- player/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/player/index.html b/player/index.html index 68459b8..83c0184 100644 --- a/player/index.html +++ b/player/index.html @@ -28,7 +28,7 @@ analyticsFunction // from textAdventurePlayer.js ); await textAdvEngine.loadDatabaseFromFile( - "../../games/textadventurejs_teaser.tadb.json" + "../games/textadventurejs_teaser.tadb.json" ); }); From cbaa8431053bbe226e0ae06e1923b9a2e14e80fe Mon Sep 17 00:00:00 2001 From: Daniel Korgel Date: Thu, 1 Jan 2026 12:46:13 +0100 Subject: [PATCH 2/5] Fixed some typos in readme --- .vscode/settings.json | 5 +++++ README.md | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5268e29 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "tadb" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index f9d8be3..6abb914 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # TextAdventureJS -A text based adventure engine written in Javascript. +A text based adventure engine written in JavaScript. Allows you to create your own text adventure games and embed them into your website or share and play them with included demo player. -- Games are json files, that follow the textAdventureGameDatabase schema (tadb). +- Games are json files, that follow the textAdventureGameDatabase-schema (tadb). - Editor folder contains an editor that allows to create games with a GUI. -- Player folder contains a demo player that shows how to integreate the engine +- Player folder contains a demo player that shows how to integrate the engine The library and the player are written in pure JavaScript. The editor uses jQuery. @@ -24,7 +24,7 @@ This repo also provides a full editor including debugger functionality for creat Try it here: https://dak0r.github.io/TextAdventureJS/editor/ ## Usage -Usage is simple: the engine needs to be initilized with a JS functions that allows the engine to write output and to clear all written output. Then any compatible game file can be loaded: +Usage is simple: the engine needs to be initialized with a JS functions that allows the engine to write output and to clear all written output. Then any compatible game file can be loaded: ```js var textAdvEngine = new textAdventureEngine(writeLine, clearArea); textAdvEngine.loadDatabaseFromFile( @@ -96,7 +96,7 @@ Each game exists of `objects` which are either in the players inventory or in `l Locations are basically groups of `objects`. -The description text of a location soley exists of the objects which can be found in it. This means an empty location has no description. Thus a location should always have at least one object, at any given moment. +The description text of a location solely exists of the objects which can be found in it. This means an empty location has no description. Thus a location should always have at least one object, at any given moment. ### Verbs @@ -135,7 +135,7 @@ To close the chest again, you can use `objectReplaceInLocation` again in `chest_ #### Object specific failure texts -If the player tries to do soemthing with an object and the action is not defined, the engine will output the default verb failure sentance. In some cases you might find it more immersive to have an object specfic failure text, though verbs have no object specifc failures, as they usually will vary by object. +If the player tries to do something with an object and the action is not defined, the engine will output the default verb failure sentence. In some cases you might find it more immersive to have an object specific failure text, though verbs have no object specific failures, as they usually will vary by object. So In this case, you simply have to add the verb as an action to the object and add your failure message as text to the action. @@ -152,7 +152,7 @@ Commands must be used for any logic that goes beyond outputting text. You can ch #### 'this' in command parameters -If the command is supposed to affect the object that the action is defined on, you can refer to it using `this` instead of its unique nanme. +If the command is supposed to affect the object that the action is defined on, you can refer to it using `this` instead of its unique name. #### objectRemoveFromLocation @@ -235,8 +235,8 @@ Defined events are: - `command`: a command was successfully parsed - `unknown_verb`: the user tried to use a verb that is not defined -- `unknwon_object`: the user tried to use an object that is not present in the players current location or inventory. -- `unkown_verb_for_object`: the user tried to do something with an object that is not defined +- `unknown_object`: the user tried to use an object that is not present in the players current location or inventory. +- `unknown_verb_for_object`: the user tried to do something with an object that is not defined - `unknown_command`: other parsing error Each event contains a body, that includes: From f4cc0ddd01dd70e32ae9eee39a0a7243f0f7d88a Mon Sep 17 00:00:00 2001 From: Daniel Korgel Date: Thu, 1 Jan 2026 12:57:38 +0100 Subject: [PATCH 3/5] Removed deprecated useableObjects array and fixed typos --- .vscode/settings.json | 5 +- editor/tba_editor.js | 8 +-- games/new_project.tadb.json | 6 +- games/textadventurejs_teaser.tadb.json | 76 +++++++------------------- player/index.html | 2 +- textAdventure.js | 12 ++-- textAdventureGameDatabase.schema.json | 9 +-- 7 files changed, 37 insertions(+), 81 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5268e29..569b8e9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,8 @@ { "cSpell.words": [ - "tadb" + "Bitstream", + "Korgel", + "tadb", + "textadventurejs" ] } \ No newline at end of file diff --git a/editor/tba_editor.js b/editor/tba_editor.js index 368470e..0767b52 100644 --- a/editor/tba_editor.js +++ b/editor/tba_editor.js @@ -123,7 +123,7 @@ $(document).ready(function () { ) { e.preventDefault(); if (window.showOpenFilePicker) { - // mimic click handler behaviour but keep it simple for keyboard + // mimic click handler behavior but keep it simple for keyboard $(".file-drop-area").click(); } else { $("#fileInput").click(); @@ -319,10 +319,10 @@ async function getDefaultProjectJson() { function updateEditorState() { if (TBA_DATABASE !== undefined) { $("#drop-area").hide(); - $("#editor-aera").show(); + $("#editor-area").show(); } else { $("#drop-area").show(); - $("#editor-aera").hide(); + $("#editor-area").hide(); } } @@ -1414,7 +1414,7 @@ function generateTextArea(name, value, onChange) { function getNewVerb(name) { var newVerb = {}; - newVerb["failure"] = "That didnt work."; + newVerb["failure"] = "That didn't work."; newVerb["words"] = [name]; return newVerb; } diff --git a/games/new_project.tadb.json b/games/new_project.tadb.json index b0e474b..b03658a 100644 --- a/games/new_project.tadb.json +++ b/games/new_project.tadb.json @@ -136,8 +136,7 @@ "text": ["A mysterious object."], "commands": [] } - }, - "useableObjects": {} + } }, "demo_object_pickedUp": { "words": ["object", "obj"], @@ -154,8 +153,7 @@ "text": ["A mysterious object."], "commands": [] } - }, - "useableObjects": {} + } }, "door_to_second_room": { "words": ["door", "north", "up"], diff --git a/games/textadventurejs_teaser.tadb.json b/games/textadventurejs_teaser.tadb.json index 4a7be95..c668b0a 100644 --- a/games/textadventurejs_teaser.tadb.json +++ b/games/textadventurejs_teaser.tadb.json @@ -121,30 +121,6 @@ } }, "objects": { - "template_object": { - "words": ["desk", "desktop", "workingplace"], - "locationDescription": "", - "actions": { - "pickup": { - "text": ["okay got it"], - "commands": ["inventoryAdd template_object"] - }, - "look": { - "text": ["soft and comfy"], - "commands": [] - } - }, - "useableObjects": { - "bedroom_desk": { - "text": ["soft and comfy"], - "commands": [] - }, - "test": { - "text": ["works"], - "commands": [] - } - } - }, "plaster_wall_door_unidentified": { "words": ["wall", "walls", "plaster", "metal"], "locationDescription": "Plaster is crumbling from the WALLS.", @@ -165,8 +141,7 @@ "text": ["Why would you do that?"], "commands": [] } - }, - "useableObjects": {} + } }, "plaster_wall_door_door_visible": { "words": ["wall", "walls"], @@ -187,8 +162,7 @@ "objectRemoveFromLocation metal_behind_plaster" ] } - }, - "useableObjects": {} + } }, "plaster_wall_door_door_found": { "words": ["wall", "rusty", "door"], @@ -206,8 +180,7 @@ "text": ["You open the rusty door and enter a hallway."], "commands": ["gotoLocation long_hallway"] } - }, - "useableObjects": {} + } }, "metal_behind_plaster": { "words": ["rust", "rusty", "metal", "plaster"], @@ -234,8 +207,7 @@ "objectRemoveFromLocation metal_behind_plaster" ] } - }, - "useableObjects": {} + } }, "room_start_chamber_dark": { "words": ["room"], @@ -253,10 +225,9 @@ "text": ["If only you'd had something to enlighten the room with..."], "commands": [] } - }, - "useableObjects": {} + } }, - "room_start_chamber_enlighted": { + "room_start_chamber_enlightened": { "words": ["room"], "locationDescription": "The room is slightly lit.", "actions": { @@ -268,8 +239,7 @@ "text": ["The room is already slightly illuminated."], "commands": [] } - }, - "useableObjects": {} + } }, "box_matches_unidentified": { "words": ["box"], @@ -288,8 +258,7 @@ ], "commands": [] } - }, - "useableObjects": {} + } }, "box_matches_pickedUp": { "words": ["box", "matches", "matchbox", "match"], @@ -297,22 +266,22 @@ "actions": { "use": { "text": [ - "You light the last match. The room is now slightly illumanted." + "You light the last match. The room is now slightly illuminated." ], "commands": [ "objectReplaceInLocation plaster_wall_door_unidentified plaster_wall_door_door_visible", - "objectReplaceInLocation room_start_chamber_dark room_start_chamber_enlighted", + "objectReplaceInLocation room_start_chamber_dark room_start_chamber_enlightened", "objectAddToLocation metal_behind_plaster", "inventoryRemove box_matches_pickedUp" ] }, "light": { "text": [ - "You light the last match. The room is now slightly illumanted." + "You light the last match. The room is now slightly illuminated." ], "commands": [ "objectReplaceInLocation plaster_wall_door_unidentified plaster_wall_door_door_visible", - "objectReplaceInLocation room_start_chamber_dark room_start_chamber_enlighted", + "objectReplaceInLocation room_start_chamber_dark room_start_chamber_enlightened", "objectAddToLocation metal_behind_plaster", "inventoryRemove box_matches_pickedUp" ] @@ -328,8 +297,7 @@ "text": ["An almost empty box of matches."], "commands": [] } - }, - "useableObjects": {} + } }, "box_matches_dropped": { "words": ["box", "matches", "matchbox"], @@ -346,8 +314,7 @@ "text": ["A small box of matches, that you dropped here..."], "commands": [] } - }, - "useableObjects": {} + } }, "room_hallway": { "words": ["room", "hallway"], @@ -357,8 +324,7 @@ "text": [""], "commands": [] } - }, - "useableObjects": {} + } }, "exit_light": { "words": ["light", "exit"], @@ -376,8 +342,7 @@ ], "commands": [] } - }, - "useableObjects": {} + } }, "exit_light_without_leaflet": { "words": ["light", "exit"], @@ -395,8 +360,7 @@ ], "commands": [] } - }, - "useableObjects": {} + } }, "dev_leaflet_on_ground": { "words": ["leaflet", "notice", "paper"], @@ -416,8 +380,7 @@ "inventoryAdd dev_leaflet_pickedUp" ] } - }, - "useableObjects": {} + } }, "dev_leaflet_pickedUp": { "words": ["leaflet", "notice", "paper"], @@ -438,8 +401,7 @@ "inventoryRemove dev_leaflet_pickedUp" ] } - }, - "useableObjects": {} + } } }, "locations": { diff --git a/player/index.html b/player/index.html index 83c0184..40ef9fe 100644 --- a/player/index.html +++ b/player/index.html @@ -17,7 +17,7 @@