Start label -> Quest's label -> I don't really know why is that happening, that's why I'm asking here on forum. I would really appreciate every help and suggestions anyone would have.
Code is here ->
Code: Select all
default quest_info = {
"Alice": [
{"id": "1", "title": "Find the Lost Book", "status": "available", "locked": False, "label": "quest_alice_1", "description": "Alice's favorite book is missing. \n Help her find it in the library."},
# More quests for Alice
],
"Bob": [
{"id": "1", "title": "Gather Herbs", "status": "available", "locked": False, "label": "quest_bob_1", "description": "Bob needs herbs for his potion. \n Collect them in the forest."},
# More quests for Bob
],
"Alexa": [
{"id": "1", "title": "Help her", "status": "available", "locked": False, "label": "quest_alexa_1", "description": "Alexa needs help, go to her."},
# More quests for Alexa
],
# Additional characters and their quests
}
default current_quest = (None, None)
screen quest_overview():
zorder 100
modal True
frame:
xalign 0.5 yalign 0.5
xsize 1600
ysize 900
hbox:
xpos 0.10
ypos 0.2
spacing 350
vbox:
spacing 25
for char_name, quests in quest_info.items():
for quest in quests:
if quest['status'] == "available" and not quest['locked']:
textbutton f"{char_name}: {quest['title']}" action [SetVariable('current_quest', (char_name, quest['id'])), Show("quest_overview")]
vbox id "quest_details":
$ current_quest_details = None
$ char_name, quest_id = current_quest if current_quest else (None, None)
if char_name and quest_id:
for name, quests in quest_info.items():
if name == char_name:
for quest in quests:
if quest['id'] == quest_id:
$ current_quest_details = quest
break
if current_quest_details:
break
if current_quest_details:
text f"Character: {char_name}"
text f"Quest: {current_quest_details['title']}"
text "Description: {}".format(current_quest_details.get('description', 'No description available.'))
textbutton "Start Quest" action [SetVariable('current_quest', (None, None)), Jump(current_quest_details['label'])]
else:
text "Select a quest to view details."
vbox:
xalign 0.90 yalign 0.108
textbutton "Close":
idle_background Frame("images/UI/button glossy idle.png", 12, 12)
hover_background Frame("images/UI/button glossy hover.png", 12, 12)
action [SetVariable('current_quest', (None, None)), Return()]
init python:
def check_quest_status():
completed_quests = []
active_quests = []
available_quests = []
for char, quests in quest_info.items():
for quest in quests:
if quest["status"] == "completed":
completed_quests.append(quest["title"])
elif quest["status"] == "active":
active_quests.append(quest["title"])
elif quest["status"] == "available":
available_quests.append(quest["title"])
# Check quests status in console
print("Completed Quests:", completed_quests)
print("Active Quests:", active_quests)
print("Available Quests:", available_quests)