Merge branch 'tui'
This commit is contained in:
commit
d1c96c5afc
2 changed files with 25 additions and 14 deletions
18
main.go
18
main.go
|
@ -23,7 +23,7 @@ func InputPrompt(scr *Window) string {
|
||||||
w.Box(0, 0)
|
w.Box(0, 0)
|
||||||
Echo(true)
|
Echo(true)
|
||||||
msg := "Game name: "
|
msg := "Game name: "
|
||||||
w.MovePrint(0, 1, " New game information ")
|
w.MovePrint(0, 1, " New game information ")
|
||||||
w.MovePrint(2, 2, msg)
|
w.MovePrint(2, 2, msg)
|
||||||
w.Move(2, 2+len(msg))
|
w.Move(2, 2+len(msg))
|
||||||
input, err := w.GetString(16) // character input box
|
input, err := w.GetString(16) // character input box
|
||||||
|
@ -32,7 +32,7 @@ func InputPrompt(scr *Window) string {
|
||||||
}
|
}
|
||||||
w.MovePrint(3, 2, input)
|
w.MovePrint(3, 2, input)
|
||||||
w.Refresh()
|
w.Refresh()
|
||||||
Echo(false)
|
Echo(false)
|
||||||
for {
|
for {
|
||||||
ch := w.GetChar()
|
ch := w.GetChar()
|
||||||
switch Key(ch) {
|
switch Key(ch) {
|
||||||
|
@ -52,14 +52,14 @@ func NewGame(scr *Window) {
|
||||||
}
|
}
|
||||||
my_npcs := MakeNpcs()
|
my_npcs := MakeNpcs()
|
||||||
game.DataStored.Npcs = my_npcs
|
game.DataStored.Npcs = my_npcs
|
||||||
scr.MovePrintf(1, 2, "Created new game \"%v\"!", game.SaveGame)
|
scr.MovePrintf(1, 2, "Created new game \"%v\"!", game.SaveGame)
|
||||||
for i:=0; i<len(game.DataStored.Npcs); i++ {
|
for i := 0; i < len(game.DataStored.Npcs); i++ {
|
||||||
scr.MovePrintf(2+i, 2, "Initialising \"%v\"...", game.DataStored.Npcs[i].Name)
|
scr.MovePrintf(2+i, 2, "Initialising \"%v\"...", game.DataStored.Npcs[i].Name)
|
||||||
scr.MovePrintf(3+i, 2, "Found NPC query string!")
|
scr.MovePrintf(3+i, 2, "Found NPC query string!")
|
||||||
scr.Refresh()
|
scr.Refresh()
|
||||||
|
|
||||||
}
|
}
|
||||||
// println(game.DataStored.Npcs[0].Name)
|
// println(game.DataStored.Npcs[0].Name)
|
||||||
}
|
}
|
||||||
func Continue(scr *Window) {
|
func Continue(scr *Window) {
|
||||||
// recover state from last save?
|
// recover state from last save?
|
||||||
|
|
21
mknpcs.go
21
mknpcs.go
|
@ -1,18 +1,29 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "gitlab.com/stvnliu/ai_game/utils/types"
|
. "gitlab.com/stvnliu/ai_game/utils/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MakeNpcs() []Npc {
|
func MakeNpcs() []Npc {
|
||||||
npcs := []Npc {}
|
npcs := []Npc{}
|
||||||
helper01 := Npc{
|
helper01 := Npc{
|
||||||
Name: "Helper01_NPC",
|
Name: "Helper01_NPC",
|
||||||
Ai: NpcAi{
|
Ai: NpcAi{
|
||||||
PromptCharacterString: "You are a new helper assisting new players of a role-playing game set in $SCENE$, in a village called $VILLAGE$. With the information immediately preceeding, output only what you would say to a new player who just arrived in the village to provide helpful guidance.",
|
PromptCharacterString: "You are a new helper assisting new players of a role-playing game set in $SCENE$, in a village called $VILLAGE$. With the information immediately preceeding, output only what you would say to a new player who just arrived in the village to provide helpful guidance.",
|
||||||
QueryFromTableName: "helper",
|
QueryFromTableName: "helper",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
npcs = append(npcs, helper01)
|
npcs = append(npcs, helper01)
|
||||||
return npcs
|
|
||||||
|
rulmarc := Npc{
|
||||||
|
Name: "Rulmarc",
|
||||||
|
Ai: NpcAi{
|
||||||
|
PromptCharacterString: "You are a medieval villager called Rulmarc.",
|
||||||
|
QueryFromTableName: "helper",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
npcs = append(npcs, rulmarc)
|
||||||
|
|
||||||
|
return npcs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue