2nd Attempt to Challenge

Just a few things first. I noticed you changed the video for File.READ, but you still left in the part where you tell people to make other_text.json on the challenge slide, but make other_strings.json on your solution (you initially use that filename around 14:45). I think it might confuse others as much as it confused me. It was hard for me to follow along on the first runthrough because I couldn’t juggle all of the different things happening during what I though was one step. I’m with you now and completely understand what to do and how dictionaries/files work. Code for challenge:

func _ready():
	set_random_story()
	$Blackboard/StoryText.text = get_from_json("other_strings.json").intro_text + ("\n\n\nCan I have " + current_story.prompt[player_words.size()] + ", please?")
	$Blackboard/TextBox.text = ""

For those wanting to have easily readable .json files without the headache of watching out for every character, this site will do it for you https://codebeautify.org/jsonviewer . I used it to make my files.

Edit: I just realized this is my post and I can spam if I want to, so here are the files in chat instead of having to download that .zip :slight_smile:

other_strings.json

{
“intro_text”: “Welcome to Loony Lips! We are going to have an amazing time together. If you’ll just give me a few words, I’ll give you funny stories.\n\n\n”,
“prompt”: “Can I have a %s please?”,
“again”: “Again!”
}

stories.json

[
{
“prompt”: [
“an adjective (one syllable)”,
“another adjective (two syllables)”,
“an animal (one syllable)”
],
“story”: “A %s %s pond…\nA %s jumps into the pond,\nSplash! Silence again.”
},
{
“prompt”: [
“an adjective”,
“a creature”,
“a name”,
“another adjective”,
“a type of monster”
],
“story”: “There once was a %s %s slayer named %s. He was so %s that even the %ss would run from him.”
}
]

1 Like

Privacy & Terms