pythonmud

I am trying to learn coding (python)


I am new to python and coding overall. I found this code and really want to get it to work and try to add things to it. But I can't even get it to run..

How do I import the modules I need? I'm trying to figure the environment thing people are talking about. I'm trying to learn code on a raspberry pi4.

Do I need to download jsonpickle and so on?

thanks for help

#A text based RPG

#Import required modules
import jsonpickle
import os
import sys
import time
from random import randint
#main game

#Variables
go = True
IsShopLocked = False
IsDaggerEquipped = False
IsSwordEquipped = False
IsLeatherHideEquipped = False

SAVEGAME_FILENAME = 'savegame.json'

game_state = dict()

Solution

  • You need to install the packages that you want to use. Some of the modules you have listed are already built into Python as Heike has commented above.

    First read some documentation on Python and what you need to get started. Try the basic 'Hello, world' before creating something more complex. There are some good tutorials for simple RPG text adventure games online that you can refer too which can be a fun way to learn some of the basics!