← Back to Community
Lets Go Adventuring
Profile icon
[deleted]

A sample of how to create your own text adventure

Voters
Profile icon
pauulina_101
Profile icon
evanpollard
Profile icon
AaronD18
Profile icon
Jakewhite121
Profile icon
AlanNowosad
Profile icon
keilankessie
Profile icon
JClohessy18
Comments
hotnewtop
Profile icon
HarshVardhan19

You need to add a break keyword after ending() on line 28 since it kept spamming You died in the terminal. And I guess it wasn't supposed to do that.

Profile icon
hello4691

The screen gets filled with too much information. You should use this:

import os def clear(): os.system('clear')

Calling clear() will clear the terminal.

Profile icon
hello4691

Also @StephenGrimes creating scenarios in a format like this is very hard and time consuming. You should make a class. With the instances being scenarios.

Profile icon
firefish

@hello4691 Actually, that is a bad idea, because on a windows system clear is not a command, cls is. So for one that works on both:

def clear(): print('\033[H\033[2J')

same way you do colours, except different ascii sequences

Profile icon
hello4691

@firefish I use it on all my repls and it works just fine

Profile icon
firefish

@hello4691 Yes, I know. That's because repl.it is a linux system. Move your code out of repl.it and onto your native windows system and then...
image
Even if it DOES work, it's good practice to use the other one.

Profile icon
hello4691

@firefish Thanks I'll keep that in mind

Profile icon
RahulChoubey1

@firefish clear works on Chrome OS's os module

Profile icon
hello4691

@RahulChoubey1 I should probably go change that in all my repls

Profile icon
firefish

@RahulChoubey1 because chromeos is a linux bootleg where the kernel is chrome