Ask coding questions

← Back to all posts
RPG TEST
squidlit (5)

hi I'm new here on repl.it so please treat me well. now that introductions are out the way could anyone reading this test this prototype rpg I'm making (I don't have a title for it yet) I've been working on it for a short period of time and would like some help from people with better experience. thank you

Commentshotnewtop
Dominicl645 (428)

so far it looks really nice,but you should make the already printed statements disappear.

squidlit (5)

@dominicl645 thank you but I have no idea how to do that so I look that up

Dominicl645 (428)

would you like some lessons in python? i will be more than willing to teach you what i know! @squidlit

[deleted]

Hi @squidlit,
You could use escape sequences
I use them in Ruby and they work in any language on any unix terminal

Dominicl645 (428)

isn't it good to learn python before you attempt something as complicated as this? no offence, but if you want to do something like this, you should at least know the basics of python. @janavishappy @squidlit

Dominicl645 (428)

hey lets upvote this for him, what do you think? @janavishappy

[deleted]

Not really, @dominicl645. My Ruby experience is very beginner but I can code complex things. I think he just needs to keep it simple.
However, as I made clear, ANSI escape sequences work in python too.
Good idea, @dominicl645. I'll upvote. It's nice

RYANTADIPARTHI (3242)

Few things would be you might want to use classes, instead of nested if statements. Just use OOP concepts here. and try not to use so many variables.

JBYT27 (1150)

yeah, pretty good! but:

  1. clearing the screen
  2. adding colors
  3. maybe add sound?
  4. scroll text maybe?

i hope this helped!

RYANTADIPARTHI (3242)

Uhh, i don't understand what your question is

Kookiez (305)

@RYANTADIPARTHI they're asking what they can improve and suggestions on their game and some help if needed too

Dominicl645 (428)

hey i gave u ur 200th upvote :) @Kookiez

Dominicl645 (428)

:) wat? did i do something wrong? i was trying to be nice. @Kookiez

Kookiez (305)

@dominicl645 oh lol u didn't do anything wrong, i was just confused

Dominicl645 (428)

ok. and i commented on ur post bout the website. @Kookiez

Baconman321 (532)

OOO 2000 lines. Just like the project im making! Uhm, like @janavishappy said, split some code into different files, that way it's easier to work with.

[deleted]

Also, you could use turtle libraries

[deleted]

I like it! Pretty impressive for a new person! Great work, @squidlit

I code in ruby but here are some suggestions

  • There are quite a lot of modes you can play in, such as mage, warrior and jester. You could separate the code into a few files so when you choose your role, the main.py file can offload the work, making each file lighter and easier to code in. For example, look at this project.
  • You could also find a more experienced coder on repl.it in the Talk section and set up a multiplayer repl
  • Lastly, maybe you could add a UI to this project. It's more complicated but, why not? (I've never done that before)

I really like this project. Good luck!
Janav

[deleted]

BTW, try eliminating some of the beginning lines. Python sets any new variable to 0 so you can say

while variable_that_has_not_been_mentioned_before = 0
  ...

Forgive my syntax

TheLegendBeacon (29)

@squidlit hmmm....

1) To clear the screen, you can use this snippet of code:

from os import system
# For Linux based systems (like repl.it)
system("clear")
# For Windows based systems
system("cls")

Pro Tip: You can execute any console command using os.system()

2) For coloured text you can use colored:

from termcolor import colored
# You can make a coloured string
colorText = colored("MAKE ME SENTIENT", "red")
print(colorText) # this will print the coloured string

# OR, you can use cprint
from termcolor import cprint
cprint("MAKE ME SENTIENT", "red") # This will print the same text

for more info check https://pypi.org/project/termcolor/ for all the effects you will ever need.

3)For the typewriter effect, you can use sys.stdout.write() in combination with a for loop.(Not print() because it creates a new line every time.)

For example:

from sys import stdout
from time import sleep

x = "string to print"

for letter in x:
   stdout.write(letter)
   stdout.flush()
   sleep(0.5) # Or whatever time you need

4) Use classes for monsters.

Upvote if this post helped you :D

tankerguy1917 (140)

if i had any suggestions, it would be to use colors, since it is kind of hard to see what is going on.
here is how i would do it

black = "\033[0;30m"
red = "\033[0;31m"
green = "\033[0;32m"
yellow = "\033[0;33m"
blue = "\033[0;34m"
magenta = "\033[0;35m"
cyan = "\033[0;36m"
white = "\033[0;37m"
bright_black = "\033[0;90m"
bright_red = "\033[0;91m"
bright_green = "\033[0;92m"
bright_yellow = "\033[0;93m"
bright_blue = "\033[0;94m"
bright_magenta = "\033[0;95m"
bright_cyan = "\033[0;96m"
bright_white = "\033[0;97m"

print(red + "hi")
would print out hi, but it would be red
just make sure to give credit to @Bookie0

TommyVictory (224)

1 thing you can do is store all those variables in a dictionary example_dict = {'Hello':'world','etc':'etc}

Coder100 (12435)

what do you need help with?

Here are my suggestions:

  • Add colors
  • Add a typewriter affect
  • Make the screen clear.