Spaces:
Runtime error
Runtime error
Hugo Garcia-Cotte
commited on
Commit
•
c427766
1
Parent(s):
e7dbad9
added win condition for ACT1
Browse files- danse_macabre.py +71 -18
danse_macabre.py
CHANGED
@@ -5,6 +5,13 @@ import os
|
|
5 |
# Set up the API key
|
6 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def main():
|
9 |
|
10 |
#Intro
|
@@ -116,6 +123,8 @@ def main():
|
|
116 |
More Context :
|
117 |
Friedrich II von Habsburg died in the Neuberg Abbey the 11 December 1344 at the age of 17. His death is very suspicious because he was the last member of this branch of the House of Habsburg. The Pope wants the inquisition (the players) to investigate, because it is the third member of this family to die within few years in this abbey. Otto der Fröhliche in 1339 then Leopold II von Habsburg in August 1344 and now Friedrich II in December. Their rival Rudolf IV made it very clear to the pope, that he doesn't want any noise. The pope can investigate, but no conclusions can be made public. Officially, they died of illness and that's it.
|
118 |
|
|
|
|
|
119 |
The Societa Templois was a holy military order created by Otto der Fröhliche to fight pagans in the east. Otto also was the main mecene of this Abbey, so their archives are kept here in the basement.
|
120 |
|
121 |
Today is the 20th of December 1344, Friedrich II died 9 days ago.
|
@@ -125,7 +134,7 @@ def main():
|
|
125 |
|
126 |
He only had one real friend : Brother Conrad, a scribe who is currently in the scriptorium. He is the last person to talk to him when he was alive.
|
127 |
|
128 |
-
There are
|
129 |
|
130 |
There are 2 important characters, remember them : Reverend Father Albrecht the Abbot who is currently in the garden, Brother Galeazzo the doctor who is currently in the mortuary."""
|
131 |
|
@@ -134,9 +143,11 @@ def main():
|
|
134 |
abbotVisited = None
|
135 |
mortuaryVisited = None
|
136 |
archivesVisited = None
|
|
|
137 |
|
138 |
while(Act1):
|
139 |
|
|
|
140 |
if "ABBEY" in nextseq:
|
141 |
nextseq=sequence(
|
142 |
sequencePrompt= Act1GlobalContext + """
|
@@ -149,9 +160,6 @@ def main():
|
|
149 |
|
150 |
Actions :
|
151 |
|
152 |
-
If the player asks to see the body of Otto der Fröhliche or Leopold II
|
153 |
-
You should respond that they are buried in the crypt and it would not be proper to exhume them.
|
154 |
-
|
155 |
If the player ask about Friedrich II von Habsburg and how he died
|
156 |
You should respond that he was visiting the abbey because it is his father who founded it and nothing was suspicious. Nobody know how he died. His body was found in the garden. His body is in the mortuary currently.
|
157 |
|
@@ -182,11 +190,13 @@ def main():
|
|
182 |
The monks lead the players to a small room where they are offered a simple meal of bread and water. The atmosphere is subdued, and the players can sense that something is amiss. The death of Friedrich II von Habsburg hangs heavy in the air, and the players can see that the monks are still coming to terms with the loss."""
|
183 |
,
|
184 |
controlPrompt="""If the player specifically decided to check the corpse of Friedrich II at the mortuary then you should respond this exact word '#NEXT:MORTUARY#'
|
|
|
185 |
If the player specifically decided to talk to the Abbot then you should respond this exact word '#NEXT:ABBOT#'
|
186 |
If the player specifically decided to talk to the Brother Conrad then you should respond this exact word '#NEXT:CONRAD#'
|
187 |
If the player specifically decided to visit the archives of the societa templois then you should respond this exact word '#NEXT:ARCHIVES#'
|
188 |
-
|
189 |
-
|
|
|
190 |
, alternativeIntro = abbeyVisited
|
191 |
)
|
192 |
abbeyVisited = "(You are now back at the entrance of the Abbey)"
|
@@ -239,7 +249,7 @@ def main():
|
|
239 |
controlPrompt="""Did the player specifically decided to leave the scriptorium ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
240 |
Or did the player specifically decided to stop talking with Brother Conrad ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
241 |
Otherwise respond '#CONTINUE#''"""
|
242 |
-
|
243 |
, alternativeIntro = conradVisited
|
244 |
)
|
245 |
conradVisited = """(You are now back in front of Conrad)
|
@@ -297,7 +307,7 @@ def main():
|
|
297 |
controlPrompt="""Did the player specifically decided to leave the garden ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
298 |
Or did the player specifically decided to stop talking with the Abbot Reverend Father Albrecht ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
299 |
Otherwise respond '#CONTINUE#''"""
|
300 |
-
|
301 |
, alternativeIntro = abbotVisited
|
302 |
)
|
303 |
abbotVisited = """(You are now back in front of the Abbot)
|
@@ -322,7 +332,7 @@ def main():
|
|
322 |
Respond that he barely checked the body and isn’t sure of the cause of death. He didn’t have any strange symptoms before death. The body was found in the garden by the Abbot.
|
323 |
|
324 |
If the player ask Brother Galeazzo about the body
|
325 |
-
Respond that the body clearly has signs of poisoning, but he was specifically told by the abbot not to examine it further before the players arrived, so he didn't and doesn't know more.
|
326 |
|
327 |
If the player Checks the eyes and mouth of the corpse
|
328 |
Respond that his eyes are completely red and his tongue is swollen. He was clearly poisoned but could be suicide.
|
@@ -330,7 +340,7 @@ def main():
|
|
330 |
(need Knowledge (medicine) or (apothecary)) If the player analyse poison or medicine
|
331 |
Respond that the poison is The Composition of Death, red copper, nitric acid, verdigris, arsenic, oak bark, rose water and black soot
|
332 |
|
333 |
-
If the player open his hands or inspect his chest
|
334 |
Respond that there is a massive scar on his chest, his heart is missing ! The doctor didn't notice this when he got the corpse. It was removed after his death. Clearly a murder !
|
335 |
|
336 |
Remember : You will talk to me as you would to a player of this game and your answers should always be one paragraph long and descriptive in a very educated writing style.
|
@@ -349,11 +359,13 @@ def main():
|
|
349 |
"Greetings, I am Brother Galeazzo, the abbey's doctor, how may I assist you ?" """
|
350 |
,
|
351 |
controlPrompt="""If the player specifically decided to leave the mortuary then you should respond this exact word '#NEXT:ABBEY#'
|
352 |
-
|
|
|
|
|
353 |
,
|
354 |
-
secondaryControlPrompt="""If the game master specifically describes that a heart has been removed from a corpse then you should respond this exact word '
|
355 |
-
Else respond '#CONTINUE#'"""
|
356 |
-
|
357 |
, alternativeIntro = mortuaryVisited
|
358 |
)
|
359 |
mortuaryVisited = "(You are now back at the mortuary)"
|
@@ -398,18 +410,57 @@ def main():
|
|
398 |
The door creaks as you push it open, revealing the dimly lit room before you, with its chained books and strange artifacts, waiting to be explored."""
|
399 |
,
|
400 |
controlPrompt="""If the player specifically decided to leave the archives then you should respond this exact word '#NEXT:ABBEY#'
|
401 |
-
Else respond '#CONTINUE#'"""
|
402 |
-
, debug =
|
403 |
, alternativeIntro = archivesVisited
|
404 |
)
|
405 |
archivesVisited = "(You are now back at the Archives)"
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
print(nextseq)
|
408 |
#For cases where the control has a bug and gives a next sequence that doesn't exist, like #NEXT:CONTINUE#
|
409 |
if "#NEXT:ACT2#" not in nextseq : nextseq = "#NEXT:ABBEY#"
|
410 |
|
411 |
print("End")
|
412 |
|
|
|
|
|
|
|
|
|
413 |
|
414 |
def sequence(sequencePrompt,sequenceIntro,controlPrompt,secondaryControlPrompt=None,alternativeIntro=None,debug=False):
|
415 |
|
@@ -505,7 +556,9 @@ def sequence(sequencePrompt,sequenceIntro,controlPrompt,secondaryControlPrompt=N
|
|
505 |
#Let's clean the control to keep only the magic words between # to see if we should skip scene
|
506 |
secondaryControl = re.search(r'#([^#]*)#', secondaryControl)
|
507 |
|
508 |
-
if secondaryControl is not None and "CLUE" in
|
509 |
-
print("This is an important clue ! "
|
|
|
|
|
510 |
|
511 |
main()
|
|
|
5 |
# Set up the API key
|
6 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
7 |
|
8 |
+
# Create the clue dictionary
|
9 |
+
cluesList = []
|
10 |
+
clue_missing_heart = "#CLUE:MISSING_HEART#"
|
11 |
+
clue_otto_missing_heart = "#CLUE:OTTO_MISSING_HEART#"
|
12 |
+
|
13 |
+
debug = False
|
14 |
+
|
15 |
def main():
|
16 |
|
17 |
#Intro
|
|
|
123 |
More Context :
|
124 |
Friedrich II von Habsburg died in the Neuberg Abbey the 11 December 1344 at the age of 17. His death is very suspicious because he was the last member of this branch of the House of Habsburg. The Pope wants the inquisition (the players) to investigate, because it is the third member of this family to die within few years in this abbey. Otto der Fröhliche in 1339 then Leopold II von Habsburg in August 1344 and now Friedrich II in December. Their rival Rudolf IV made it very clear to the pope, that he doesn't want any noise. The pope can investigate, but no conclusions can be made public. Officially, they died of illness and that's it.
|
125 |
|
126 |
+
Both Otto der Fröhliche and Leopold II von Habsburg are burried in the Abbey's crypt.
|
127 |
+
|
128 |
The Societa Templois was a holy military order created by Otto der Fröhliche to fight pagans in the east. Otto also was the main mecene of this Abbey, so their archives are kept here in the basement.
|
129 |
|
130 |
Today is the 20th of December 1344, Friedrich II died 9 days ago.
|
|
|
134 |
|
135 |
He only had one real friend : Brother Conrad, a scribe who is currently in the scriptorium. He is the last person to talk to him when he was alive.
|
136 |
|
137 |
+
There are 5 important locations, remember them : The 3 floors of the library, the mortuary, the archives of the Societa Templois in the basement, the crypt where Otto der Fröhliche and Leopold II von Habsburg are burried.
|
138 |
|
139 |
There are 2 important characters, remember them : Reverend Father Albrecht the Abbot who is currently in the garden, Brother Galeazzo the doctor who is currently in the mortuary."""
|
140 |
|
|
|
143 |
abbotVisited = None
|
144 |
mortuaryVisited = None
|
145 |
archivesVisited = None
|
146 |
+
cryptsVisited = None
|
147 |
|
148 |
while(Act1):
|
149 |
|
150 |
+
quest_journal()
|
151 |
if "ABBEY" in nextseq:
|
152 |
nextseq=sequence(
|
153 |
sequencePrompt= Act1GlobalContext + """
|
|
|
160 |
|
161 |
Actions :
|
162 |
|
|
|
|
|
|
|
163 |
If the player ask about Friedrich II von Habsburg and how he died
|
164 |
You should respond that he was visiting the abbey because it is his father who founded it and nothing was suspicious. Nobody know how he died. His body was found in the garden. His body is in the mortuary currently.
|
165 |
|
|
|
190 |
The monks lead the players to a small room where they are offered a simple meal of bread and water. The atmosphere is subdued, and the players can sense that something is amiss. The death of Friedrich II von Habsburg hangs heavy in the air, and the players can see that the monks are still coming to terms with the loss."""
|
191 |
,
|
192 |
controlPrompt="""If the player specifically decided to check the corpse of Friedrich II at the mortuary then you should respond this exact word '#NEXT:MORTUARY#'
|
193 |
+
If the player specifically decided to check the crypt of corpse of Otto der Fröhliche or Leopold II then you should respond this exact word '#NEXT:CRYPT#'
|
194 |
If the player specifically decided to talk to the Abbot then you should respond this exact word '#NEXT:ABBOT#'
|
195 |
If the player specifically decided to talk to the Brother Conrad then you should respond this exact word '#NEXT:CONRAD#'
|
196 |
If the player specifically decided to visit the archives of the societa templois then you should respond this exact word '#NEXT:ARCHIVES#'
|
197 |
+
If the player specifically decided to visit the archives of the societa templois then you should respond this exact word '#NEXT:CRYPT#'
|
198 |
+
Else if the player does something not listed above respond '#CONTINUE#'"""
|
199 |
+
, debug = debug
|
200 |
, alternativeIntro = abbeyVisited
|
201 |
)
|
202 |
abbeyVisited = "(You are now back at the entrance of the Abbey)"
|
|
|
249 |
controlPrompt="""Did the player specifically decided to leave the scriptorium ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
250 |
Or did the player specifically decided to stop talking with Brother Conrad ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
251 |
Otherwise respond '#CONTINUE#''"""
|
252 |
+
, debug=debug
|
253 |
, alternativeIntro = conradVisited
|
254 |
)
|
255 |
conradVisited = """(You are now back in front of Conrad)
|
|
|
307 |
controlPrompt="""Did the player specifically decided to leave the garden ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
308 |
Or did the player specifically decided to stop talking with the Abbot Reverend Father Albrecht ? If yes, you should respond this exact word '#NEXT:ABBEY#'
|
309 |
Otherwise respond '#CONTINUE#''"""
|
310 |
+
, debug=debug
|
311 |
, alternativeIntro = abbotVisited
|
312 |
)
|
313 |
abbotVisited = """(You are now back in front of the Abbot)
|
|
|
332 |
Respond that he barely checked the body and isn’t sure of the cause of death. He didn’t have any strange symptoms before death. The body was found in the garden by the Abbot.
|
333 |
|
334 |
If the player ask Brother Galeazzo about the body
|
335 |
+
Respond that the body clearly has signs of poisoning, but he was specifically told by the abbot not to examine it further before the players arrived, so he didn't and doesn't know more, but now that they are here is happy to help.
|
336 |
|
337 |
If the player Checks the eyes and mouth of the corpse
|
338 |
Respond that his eyes are completely red and his tongue is swollen. He was clearly poisoned but could be suicide.
|
|
|
340 |
(need Knowledge (medicine) or (apothecary)) If the player analyse poison or medicine
|
341 |
Respond that the poison is The Composition of Death, red copper, nitric acid, verdigris, arsenic, oak bark, rose water and black soot
|
342 |
|
343 |
+
If the player open his hands or inspect his chest or remove the flag
|
344 |
Respond that there is a massive scar on his chest, his heart is missing ! The doctor didn't notice this when he got the corpse. It was removed after his death. Clearly a murder !
|
345 |
|
346 |
Remember : You will talk to me as you would to a player of this game and your answers should always be one paragraph long and descriptive in a very educated writing style.
|
|
|
359 |
"Greetings, I am Brother Galeazzo, the abbey's doctor, how may I assist you ?" """
|
360 |
,
|
361 |
controlPrompt="""If the player specifically decided to leave the mortuary then you should respond this exact word '#NEXT:ABBEY#'
|
362 |
+
If the player specifically decided to go to the crypt then you should respond this exact word '#NEXT:ABBEY#'
|
363 |
+
If the player specifically decided to remove the flag on the body then you should respond this exact word '#CONTINUE#
|
364 |
+
Else if the player does something not listed above respond '#CONTINUE#'"""
|
365 |
,
|
366 |
+
secondaryControlPrompt="""If the game master specifically describes that a heart has been removed from a corpse then you should respond this exact word '"""+clue_missing_heart+"""'
|
367 |
+
Else if the player does something not listed above respond '#CONTINUE#'"""
|
368 |
+
, debug = debug
|
369 |
, alternativeIntro = mortuaryVisited
|
370 |
)
|
371 |
mortuaryVisited = "(You are now back at the mortuary)"
|
|
|
410 |
The door creaks as you push it open, revealing the dimly lit room before you, with its chained books and strange artifacts, waiting to be explored."""
|
411 |
,
|
412 |
controlPrompt="""If the player specifically decided to leave the archives then you should respond this exact word '#NEXT:ABBEY#'
|
413 |
+
Else if the player does something not listed above respond '#CONTINUE#'"""
|
414 |
+
, debug = debug
|
415 |
, alternativeIntro = archivesVisited
|
416 |
)
|
417 |
archivesVisited = "(You are now back at the Archives)"
|
418 |
|
419 |
+
if "CRYPT" in nextseq:
|
420 |
+
nextseq=sequence(
|
421 |
+
sequencePrompt= Act1GlobalContext + """
|
422 |
+
|
423 |
+
More Context :
|
424 |
+
They are exploring the crypt of the abbey of Neuberg where Both Otto der Fröhliche and Leopold II von Habsburg are burried.
|
425 |
+
|
426 |
+
It is a very solemn crypt with a massive statue of Otto der Fröhliche in armor, and it’s written below : Otto slaying the heretics. Lots of candles and gifts in front of him. One Monk is crying, this family was the abbey’s only protectors, what will happen now ?
|
427 |
+
|
428 |
+
If the player wants to exhume or inspect the body of Otto der Fröhliche or Leopold II"""+
|
429 |
+
"Respond that this would be highly improper and the monks will never allow it." if clue_missing_heart not in cluesList else "Respond that the monks agree to exhume the corpses of Otto der Fröhliche and Leopold II von Habsburg. Then the player see that their hearts are missing too ! It was removed recently apparently."
|
430 |
+
+"""
|
431 |
+
|
432 |
+
Remember : You will talk to me as you would to a player of this game and your answers should always be one paragraph long and descriptive in a very educated writing style.
|
433 |
+
"""
|
434 |
+
,
|
435 |
+
sequenceIntro="""As you enter the solemn crypt of the Neuberg Abbey, a feeling of reverence descends upon you.
|
436 |
+
The dimly-lit space is lined with ornate pillars and arches, giving it a distinctly medieval feel.
|
437 |
+
At the center of the room stands a massive statue of Otto der Fröhliche in full armor, towering over the visitors.
|
438 |
+
Below the statue, it is written "Otto slaying the heretics", a reminder of the late ruler's role in the holy military order.
|
439 |
+
The floor is covered in intricate mosaics depicting various religious scenes. You notice that there are numerous candles and gifts placed in front of the statue, a sign of the reverence and devotion that the people of the abbey had for their protectors.
|
440 |
+
|
441 |
+
As you look around, you see a monk crying in the corner, clearly distressed by the loss of this branch of the Habsburg family."""
|
442 |
+
,
|
443 |
+
controlPrompt="""If the player specifically decided to leave the crypts then you should respond this exact word '#NEXT:ABBEY#'
|
444 |
+
If the player specifically decided to go to the mortuary then you should respond this exact word '#NEXT:ABBEY#'
|
445 |
+
Else if the player does something not listed above respond '#CONTINUE#'"""
|
446 |
+
,
|
447 |
+
secondaryControlPrompt=None if clue_missing_heart not in cluesList else """If the game master specifically describes that the heart from Otto der Fröhliche or Leopold II von Habsburg has been removed then you should respond this exact word '"""+clue_otto_missing_heart+"""'
|
448 |
+
Else if the player does something not listed above respond '#CONTINUE#'"""
|
449 |
+
, debug = debug
|
450 |
+
, alternativeIntro = cryptsVisited
|
451 |
+
)
|
452 |
+
cryptsVisited = "(You are now back at the Crypt)"
|
453 |
+
|
454 |
print(nextseq)
|
455 |
#For cases where the control has a bug and gives a next sequence that doesn't exist, like #NEXT:CONTINUE#
|
456 |
if "#NEXT:ACT2#" not in nextseq : nextseq = "#NEXT:ABBEY#"
|
457 |
|
458 |
print("End")
|
459 |
|
460 |
+
def quest_journal():
|
461 |
+
if clue_otto_missing_heart in cluesList: print("(Journal : SUCCESS ! You managed to prove that heresy was at work ! You may continue playing freely if you want.)")
|
462 |
+
elif clue_missing_heart in cluesList: print("(Journal : Friedrich II's heart was removed after his death, this is a proof that he was murdured ! Let's investigate his past further to understand why)")
|
463 |
+
else : print("(Journal : Friedrich II's death is very suspicious, I have to determine if this is a murder, a suicide or simply fate)")
|
464 |
|
465 |
def sequence(sequencePrompt,sequenceIntro,controlPrompt,secondaryControlPrompt=None,alternativeIntro=None,debug=False):
|
466 |
|
|
|
556 |
#Let's clean the control to keep only the magic words between # to see if we should skip scene
|
557 |
secondaryControl = re.search(r'#([^#]*)#', secondaryControl)
|
558 |
|
559 |
+
if secondaryControl is not None and "CLUE" in secondaryControl.group(0):
|
560 |
+
print("This is an important clue ! ")
|
561 |
+
cluesList.append(secondaryControl.group(0))
|
562 |
+
quest_journal()
|
563 |
|
564 |
main()
|