I’ve seen variations on this, like folks building a list of things with a list of indexed text, but not quite this…
In I7, we often do things like:
To say sharon_travel_things: say "Sharon catches up to you[if Room_Crossing encloses the player], carefully crossing the river on the floating log[else if Room_Swimming_Hole encloses the player] at the swimming hole[else if Room_Railroad_Tracks] as you reach the railroad crossing[else if Room_Grassy_Field encloses the player] in the big grassy field[else if player is in Region_Dirt_Road] as you walk along the dirt road[end if]."
However, as this gets more complicated, especially with nested if-thens which I7 doesn’t allow here, I want to simply build up a text string, like I have often done in Python or JS:
def sharon_travel_things(): build_text = "Sharon catches up to you" if location == "Room_Crossing": build_text += ", carefully crossing the river on the floating log" elif location == "Room_Swimming_Hole": build_text += " at the swimming hole" elif location == "Room_Railroad_Tracks": build_text += " as you reach the railroad crossing" elif location == "Room_Grassy_Field": build_text += " in the big grassy field" elif region == "Region_Dirt_Road": build_text += " as you walk along the dirt road" build_text += "." print(build_text)
This code obviously has a lot more clarity and is much more maintainable. What is the I7 equivalent with the minimum fuss?