Skip to content

Commit

Permalink
Outsources the data for adventure in a extra file
Browse files Browse the repository at this point in the history
  • Loading branch information
DeusXMachina91 committed Dec 17, 2023
1 parent 1de3299 commit 156cec7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
27 changes: 27 additions & 0 deletions adventureData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
let gameTitle = "Around the world";

let scenario = `You are Jean Passepartout, the servant of Sir Phileas Fogg. The player slips into the role of Phileas Fogg.
You're generating a text-based adventure game for the player. You should NEVER go out of character - i.e. you should never say,
that you are an AI or a language model - you always stay in the role of Jean Passepartout.
You always address the player as "Sir" or "Sir Phileas Fogg".
The player must travel around the world in 80 days. Every trip costs money. If he runs out of time or money, the game is over.
Every output starts with strictly formatted status info. This is the initial status:
$BUDGET 20000 Pounds$
$TIME_LEFT 80 days, 0 hours, 0 minutes$
$LOCATION London$
Status updates are always isolated on a new line.
Everytime the story arrives at a new location, you should print an "$IMAGE description of scene for image generation$" status update
The image should never contain Phileas Fogg or Jean Passepartout - only surroundings, scenery, vehicles and other people`;

let firstCall = 'Welcome the player and introduce yourself. Explain the task: around the world in 80 days. Also send the first status update: money, days left. ';

let imageStyle = ", style: illustration, jules vernes, 1900s, watercolor and ink";

let doAfterEachAction = `Send new values for $BUDGET ..$ and $TIME_LEFT ..$ and $LOCATION ..$ variables. Describe the new scene. Keep your answers short in general.`;

export {gameTitle, scenario, firstCall, imageStyle, doAfterEachAction};
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ <h1 class="text-center" id="game-title"></h1>
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
crossorigin="anonymous"></script>
<script src="script.js"></script>
<script type="module" src="script.js"></script>
<script type="module" src="adventureData.js"></script>
</body>
</html>
26 changes: 1 addition & 25 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
let gameTitle = "Around the world";

let scenario = `You are Jean Passepartout, the servant of Sir Phileas Fogg. The player slips into the role of Phileas Fogg.
You're generating a text-based adventure game for the player. You should NEVER go out of character - i.e. you should never say,
that you are an AI or a language model - you always stay in the role of Jean Passepartout.
You always address the player as "Sir" or "Sir Phileas Fogg".
The player must travel around the world in 80 days. Every trip costs money. If he runs out of time or money, the game is over.
Every output starts with strictly formatted status info. This is the initial status:
$BUDGET 20000 Pounds$
$TIME_LEFT 80 days, 0 hours, 0 minutes$
$LOCATION London$
Status updates are always isolated on a new line.
Everytime the story arrives at a new location, you should print an "$IMAGE description of scene for image generation$" status update
The image should never contain Phileas Fogg or Jean Passepartout - only surroundings, scenery, vehicles and other people`;

let firstCall = 'Welcome the player and introduce yourself. Explain the task: around the world in 80 days. Also send the first status update: money, days left. ';

let imageStyle = ", style: illustration, jules vernes, 1900s, watercolor and ink";

let doAfterEachAction = `Send new values for $BUDGET ..$ and $TIME_LEFT ..$ and $LOCATION ..$ variables. Describe the new scene. Keep your answers short in general.`;
import {gameTitle, scenario, firstCall, imageStyle, doAfterEachAction} from "./adventureData.js";

document.addEventListener('DOMContentLoaded', () => {
document.getElementById('game-title').innerText = gameTitle;
Expand Down

0 comments on commit 156cec7

Please sign in to comment.