i need help reveiwing this code to see if it works properly #7920
Replies: 7 comments
-
Okay, I see a bunch of things here. Let me condense this down firstly: init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="monika_harry_potter",
category=["literature"],
prompt="harry potter",
random=True,
)
)
label monika_twitter:
m 1rud "[player] , I have a question for you"
m 3eud "do you like fantasy novels?"
m expression "Question?{nw}"
$ _history_list.pop()
menu:
m "Question?{fast}"
"yes":
m 3wub "Really that is wonderful [player] !"
m 2esb "Fantasy is something that I myself love"
m "especially Harry potter"
m 3ekb "do you know about Harry Potter [player] {nw}"
$ _history_list.pop()
menu:
m "Question?{fast}"
"No I don't":
m 3ekd "aww that's a shame it is a really good series"
m 1esa "well I guess that means I'll just have to introduce you to the series"
"Only a muggle wouldn't know what Harry Potter is":
#Dialogue/code for this path
return
"no":
m 1ekt "aww that's a shame, [player] !"
m 2esb "Fantasy is something that I myself love"
m "especially novels like Harry potter"
m "oh well i guess fantasy isn't for everyone "
return With the excess spaces gone, let's point out some issues: init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="monika_harry_potter",
category=["literature"],
prompt="harry potter",
random=True,
)
)
label monika_twitter: label mismatch. You mention the label Next: m 1rud "[player] , I have a question for you"
m 3eud "do you like fantasy novels?" Indentation mismatch. These must be consistently spaced. We keep a standard of This then becomes m 1rud "[player], I have a question for you."
m 3eud "Do you like fantasy novels?" Next: m expression "Question?{nw}"
$ _history_list.pop()
menu:
m "Question?{fast}"
"yes":
m 3wub "Really that is wonderful [player] !"
m 2esb "Fantasy is something that I myself love"
m "especially Harry potter"
m 3ekb "do you know about Harry Potter [player] {nw}" This entire menu is not inside the label block anymore as it's not indented whatsoever. The full thing needs to go forward. Additionally, the dialogue you have for liking fantasy should be inside the m expression "Question?{nw}" #Don't forget to change 'expression' here
$ _history_list.pop()
menu:
m "Question?{fast}"
"Yes.":
m 3wub "Really that is wonderful [player] !"
m 2esb "Fantasy is something that I myself love"
m "especially Harry potter"
m 3ekb "do you know about Harry Potter [player] {nw}"
$ _history_list.pop()
menu:
m "Question?{fast}"
#Where's the yes option?
"No I don't":
m 3ekd "aww that's a shame it is a really good series"
m 1esa "well I guess that means I'll just have to introduce you to the series"
"Only a muggle wouldn't know what Harry Potter is":
#Dialogue/code for this path
"No.":
m 1ekt "aww that's a shame, [player] !"
m 2esb "Fantasy is something that I myself love"
m "especially novels like Harry potter"
m "oh well i guess fantasy isn't for everyone "
#You don't need a return here. We fall through to the bottom anyway
return I've also noticed you have some repeated dialogue: m 2esb "Fantasy is something that I myself love"
m "especially novels like Harry potter" Normally we'd put this in its own label so it's better to maintain. label monika_harry_potter_love_fantasy:
m 2esb "Fantasy is something that I myself love"
m "especially novels like Harry potter"
return which cleans dialogue to be: m expression "Question?{nw}" #Don't forget to change 'expression' here
$ _history_list.pop()
menu:
m "Question?{fast}"
"Yes.":
m 3wub "Really that is wonderful [player] !"
call monika_harry_potter_love_fantasy
m 3ekb "do you know about Harry Potter [player] {nw}"
$ _history_list.pop()
menu:
m "Question?{fast}"
#Where's the yes option?
"No I don't":
m 3ekd "aww that's a shame it is a really good series"
m 1esa "well I guess that means I'll just have to introduce you to the series"
"Only a muggle wouldn't know what Harry Potter is":
#Dialogue/code for this path
"No.":
m 1ekt "aww that's a shame, [player] !"
call monika_harry_potter_love_fantasy
m "oh well i guess fantasy isn't for everyone "
#You don't need a return here. We fall through to the bottom anyway
return There's also grammatical issues and other consistency issues I see, but I'll chalk that up to it being WIP right now. |
Beta Was this translation helpful? Give feedback.
-
thank you so much!! |
Beta Was this translation helpful? Give feedback.
-
Don't be afraid to test for yourself as well. The game will report errors in your code when you launch it with your code in it. Just be sure to set up an install for testing. Check here to see how |
Beta Was this translation helpful? Give feedback.
-
soo what would the full thing look like, because i plan to add a few more things to it. |
Beta Was this translation helpful? Give feedback.
-
init 5 python:
label monika_harry_potter:
is this good??? |
Beta Was this translation helpful? Give feedback.
-
init 5 python:
label monika_harry_potter:
here's a better version of it but im just curious if this works |
Beta Was this translation helpful? Give feedback.
-
if you are planning to submit this, its better to just make a PR. otherwise it's a bit of effort on our part to syntax check your code for something that won't be added to the mod. We're not personal tutors. |
Beta Was this translation helpful? Give feedback.
-
so i am trying to write a random event where monika will ask the player if they have read fantasy novels, if the player answers a certain way monika will ask another question. I just want to make sure that the code is good before i do anything else to it
Beta Was this translation helpful? Give feedback.
All reactions