From 4bd59b73ab642a7732b3d2bab8bdd874370d82e7 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Mon, 1 May 2023 23:21:33 -0700 Subject: [PATCH] Indentation and tune king behavior --- character_info.h | 8 +++++++- makeprompt.h | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/character_info.h b/character_info.h index 14a1adc..60f1e38 100644 --- a/character_info.h +++ b/character_info.h @@ -100,7 +100,9 @@ typedef struct } CharacterGen; CharacterGen characters[] = { #define PLAYERSAY(stuff) "Player: \"" stuff "\"\n" +#define PLAYERDO_ARG(act, arg) "Player: " act "(" arg ")\n" #define NPCSAY(stuff) NPC_NAME ": ACT_none \"" stuff "\"\n" +#define NPCDOSAY(stuff, action) NPC_NAME ": " action " \"" stuff "\"\n" #define NPCDOSAY_ARG(stuff, action, arg) NPC_NAME ": " action "(" arg ") \"" stuff "\"\n" { #undef NPC_NAME @@ -120,8 +122,12 @@ CharacterGen characters[] = { NPCSAY("I can clearly see you don't have it. Do not attempt to fool me if you value your head") PLAYERSAY("Presents it") NPCSAY("Did you just say 'presents it' out loud thinking I'd think that means you have the chalice?") + PLAYERSAY("Apologies for the tomfoolery, but I was just making sure you were the real king. I do in fact have the Chalice.") + NPCSAY("Then give it to me.") + PLAYERDO_ARG("ACT_give_item", "ITEM_Chalice") + NPCDOSAY("The chalice of gold! This is indeed knight-worthy. I pronounce you, knight!", "ACT_knights_player") "\n" - "If the player does indeed present the king with the chalice of gold, the king will be overwhelemd with respect and feel he has no choice but to knight the player, ending the game.", + "If the player does indeed present the king with the chalice of gold, the king will be overwhelemed with respect and feel he has no choice but to knight the player, ending the game. To knight the player the king says the action `ACT_knights_player`", }, { #undef NPC_NAME diff --git a/makeprompt.h b/makeprompt.h index 2325d6e..249be9e 100644 --- a/makeprompt.h +++ b/makeprompt.h @@ -697,20 +697,20 @@ void generate_chatgpt_prompt(Entity *it, PromptBuff *into) if(e->held_items.cur_index > 0) { - printf_buff(&latest_state_node, "\nThe NPC you're acting as, %s, has these items in their inventory: [", characters[it->npc_kind].name); - BUFF_ITER_I(ItemKind, &e->held_items, i) - { - printf_buff(&latest_state_node, "ITEM_%s", items[*it].enum_name); - if (i == e->held_items.cur_index - 1) + printf_buff(&latest_state_node, "\nThe NPC you're acting as, %s, has these items in their inventory: [", characters[it->npc_kind].name); + BUFF_ITER_I(ItemKind, &e->held_items, i) { - printf_buff(&latest_state_node, "]\n"); - } - else - { - printf_buff(&latest_state_node, ", "); + printf_buff(&latest_state_node, "ITEM_%s", items[*it].enum_name); + if (i == e->held_items.cur_index - 1) + { + printf_buff(&latest_state_node, "]\n"); + } + else + { + printf_buff(&latest_state_node, ", "); + } } } - } else { printf_buff(&latest_state_node, "\nThe NPC doesn't have any items.\n");