Document authorsNote
This commit is contained in:
parent
b7304aff05
commit
4a4ccdb603
2 changed files with 46 additions and 1 deletions
|
@ -16,7 +16,12 @@ You have access to (but can't modify) the `history` object which is a list of th
|
||||||
### Memory
|
### Memory
|
||||||
You have access to (but can't modify) the `memory` object which is the current user defined memory.
|
You have access to (but can't modify) the `memory` object which is the current user defined memory.
|
||||||
You can modify the memory the game uses by settings the `state.memory.context` value. This will replace the user defined memory.
|
You can modify the memory the game uses by settings the `state.memory.context` value. This will replace the user defined memory.
|
||||||
You can also set `state.memory.frontMemory` which will include whatever is there in front of even the last action when it's fed into the model, but still not display it to the user.
|
You can also set `state.memory.frontMemory`, which will include whatever is there in front of even the last action when it's fed into the model, but still not display it to the user.
|
||||||
|
|
||||||
|
### Author's Note
|
||||||
|
You can set `state.memory.authorsNote` to provide a piece of text that will always be injected three lines back in the game history. This will not be shown to the user, but the AI will see it.
|
||||||
|
|
||||||
|
As an example, if you set `state.memory.authorsNote` to `the following paragraphs are scary.`, the AI will see `[Author's note: the following paragraphs are scary.]` three lines back, causing it to be more likely to generate scary text. Another example could be `a dragon will show up soon` or `the player will soon receive a quest`.
|
||||||
|
|
||||||
### Quests
|
### Quests
|
||||||
You can modify the quests property to change the quests of the adventure mid game.
|
You can modify the quests property to change the quests of the adventure mid game.
|
||||||
|
|
40
examples/authorsNote.js
Normal file
40
examples/authorsNote.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const themes = [
|
||||||
|
{
|
||||||
|
text: 'ghost story',
|
||||||
|
matcher: /ghost|halloween|spooky/i,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'trick-or-treat',
|
||||||
|
matcher: /trick.or.treat|halloween|spooky/i,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'spooky',
|
||||||
|
matcher: /halloween|spooky/i,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const modifier = (text) => {
|
||||||
|
if (!state.setup) {
|
||||||
|
state.theme = Math.floor(Math.random() * themes.length)
|
||||||
|
state.setup = true
|
||||||
|
state.matched = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const theme = themes[state.theme]
|
||||||
|
|
||||||
|
if (!state.matched && text.match(theme.matcher)) {
|
||||||
|
state.matched = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.matched) {
|
||||||
|
state.memory = {}
|
||||||
|
} else {
|
||||||
|
const halloween = ` It involves Halloween and has a ${theme.text} theme.`
|
||||||
|
state.memory = { authorsNote: `the rest of this story is silly & playful.${halloween}` }
|
||||||
|
}
|
||||||
|
|
||||||
|
return {text}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't modify this part
|
||||||
|
modifier(text)
|
Reference in a new issue