Brand MU Day
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Learning to Code - A Sprite Break

    Scheduled Pinned Locked Moved Helping Hands
    85 Posts 28 Posters 6.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JennkrystJ
      Jennkryst @Jumpscare
      last edited by

      @Jumpscare I got linked to this here thingy:

      @IoleRae said in Learning to Code - A Sprite Break:

      https://codecombat.com/

      And there is a section where you tell your hero sprite to hero.moveTo(2), and there is a dog sprite standing there, but no instruction on how to give the dog head pats.

      This is criminal.

      Mummy Pun? MUMMY PUN!
      She/her

      JumpscareJ RozR 2 Replies Last reply Reply Quote 0
      • JumpscareJ
        Jumpscare @Jennkryst
        last edited by

        @Jennkryst

        Sorry, I don’t know how to code anything besides Evennia.

        Game-runner of Silent Heaven, a small-town horror MU.
        https://silentheaven.org

        1 Reply Last reply Reply Quote 3
        • RozR
          Roz @Jennkryst
          last edited by

          @Jennkryst This is a really weird response to someone typing out a bunch of stuff to try and help you after you asked for help.

          she/her | playlist

          JennkrystJ 1 Reply Last reply Reply Quote 10
          • tsarT
            tsar @Jumpscare
            last edited by

            @Jumpscare said in Learning to Code - A Sprite Break:

            Disclaimer: I typed this all up from memory.

            I can’t type up a damn thing from memory without looking at it 4,000,000 times, this is very impressive to me lol

            1 Reply Last reply Reply Quote 2
            • JennkrystJ
              Jennkryst @Roz
              last edited by

              @Roz @Jumpscare said she didn’t know what any of what I was talking about meant, so I explained.

              I should have clarified the code combat people are the criminals, for not letting me pet the dog.

              ahem

              Right now, I’m stuck at trying to even install evennia onto the Linux virtual machine (which finally worked on the 4th try, horray!) So progress is happening, just slow. Efforts to resume after work.

              Mummy Pun? MUMMY PUN!
              She/her

              1 Reply Last reply Reply Quote 0
              • JennkrystJ
                Jennkryst
                last edited by

                This took a dumb amount of time, but fear me.

                Glorious.PNG

                Mummy Pun? MUMMY PUN!
                She/her

                1 Reply Last reply Reply Quote 2
                • RucketR
                  Rucket
                  last edited by

                  this is a very random comment but

                  every game should have a command to pet the doggo. doggos good.

                  dog

                  that said, this is an interesting thread to follow!

                  1 Reply Last reply Reply Quote 3
                  • JennkrystJ
                    Jennkryst
                    last edited by Jennkryst

                    … and now I’ve rebooted, and

                    evennia start

                    evennia: command not found

                    flop

                    edit: Two hours trying to make it work on my own, I gripe, and then it works before any troubleshooting actually occurs. I hate it here.

                    Mummy Pun? MUMMY PUN!
                    She/her

                    IstusI 1 Reply Last reply Reply Quote 1
                    • HobbieH
                      Hobbie
                      last edited by Hobbie

                      You could theoretically run Evennia and all its prereqs inside a Docker container to avoid that.

                      However, that’s advanced work that involves mashing together two ideas that work well in a vacuum.

                      EDIT: Even more advanced theory, with Evennia running in Docker you could theoretically hook it into k8s to make it autoscale when under load. Why you would do this is another question.

                      1 Reply Last reply Reply Quote 0
                      • IstusI
                        Istus @Jennkryst
                        last edited by

                        @Jennkryst You likely did not reactivate your venv.

                        1 Reply Last reply Reply Quote 1
                        • JumpscareJ
                          Jumpscare
                          last edited by

                          @Istus is right.

                          1. source evenv/bin/activate
                            Make sure you’re in the same directory that you setup your venv before doing this command.

                          2. python3.9 -m venv evenv
                            I don’t know what this does, but it’s necessary from what I’ve seen. I think it sets what Python version you’re using. The latest version of Evennia requires 3.9 or 3.10.

                          3. cd game/directory
                            Replace game/directory with the name of your game’s directory.

                          4. evennia start
                            Now you get to shout orders to Evennia.

                          Game-runner of Silent Heaven, a small-town horror MU.
                          https://silentheaven.org

                          D 1 Reply Last reply Reply Quote 0
                          • D
                            dvoraen @Jumpscare
                            last edited by

                            @Jumpscare said in Learning to Code - A Sprite Break:

                            @Istus is right.

                            1. source evenv/bin/activate
                              Make sure you’re in the same directory that you setup your venv before doing this command.

                            2. python3.9 -m venv evenv
                              I don’t know what this does, but it’s necessary from what I’ve seen. I think it sets what Python version you’re using. The latest version of Evennia requires 3.9 or 3.10.

                            3. cd game/directory
                              Replace game/directory with the name of your game’s directory.

                            4. evennia start
                              Now you get to shout orders to Evennia.

                            #2 on your list is what creates the venv in the first place, so if it’s already established, then this step isn’t needed. Specifically, it’s telling Python 3.9 to run the venv module and output the virtual environment to the evenv directory, which will be created inside the directory you run the command from.

                            PolkP 1 Reply Last reply Reply Quote 0
                            • PolkP
                              Polk @dvoraen
                              last edited by

                              @dvoraen said in Learning to Code - A Sprite Break:

                              @Jumpscare said in Learning to Code - A Sprite Break:

                              @Istus is right.

                              1. source evenv/bin/activate
                                Make sure you’re in the same directory that you setup your venv before doing this command.

                              2. python3.9 -m venv evenv
                                I don’t know what this does, but it’s necessary from what I’ve seen. I think it sets what Python version you’re using. The latest version of Evennia requires 3.9 or 3.10.

                              3. cd game/directory
                                Replace game/directory with the name of your game’s directory.

                              4. evennia start
                                Now you get to shout orders to Evennia.

                              #2 on your list is what creates the venv in the first place, so if it’s already established, then this step isn’t needed. Specifically, it’s telling Python 3.9 to run the venv module and output the virtual environment to the evenv directory, which will be created inside the directory you run the command from.

                              This.

                              Step 1, that source command, it sets up your terminal window to know where to find your specially set up python that your Evennia is using.

                              So you have to do step 1 every time you open your terminal and get to work.

                              Step 3 tells your terminal what files you want to work on. So you do that after.

                              Step 4 starts evennia, the actual program.

                              Step 2 is part of the install process and should not need repeated.

                              1 Reply Last reply Reply Quote 0
                              • JumpscareJ
                                Jumpscare
                                last edited by Jumpscare

                                Thanks. I must’ve made a mistake at some point.

                                I consider it a miracle that I’m 97% done with making a game in Evennia and it hasn’t exploded in my face yet.

                                Game-runner of Silent Heaven, a small-town horror MU.
                                https://silentheaven.org

                                1 Reply Last reply Reply Quote 0
                                • JennkrystJ
                                  Jennkryst @Jumpscare
                                  last edited by

                                  @Jumpscare Revisiting THIS, (I trouble-shot a bug! There is an erroneous space up in (current _mod + value…) and it made things go wobbly, but I fixed it, huzzah!)

                                  … but there is another error getting thrown.

                                  self.db.characteristics = {
                                  

                                  name ‘self’ is not defined

                                  Mummy Pun? MUMMY PUN!
                                  She/her

                                  JumpscareJ 1 Reply Last reply Reply Quote 0
                                  • JumpscareJ
                                    Jumpscare @Jennkryst
                                    last edited by Jumpscare

                                    @Jennkryst
                                    Where is that code? Where’s the }? I need to see more. When asking for help on errors, it’s best to post the entire method that the error comes from.
                                    But it sounds like your indentation might be wrong and you’ve wandered outside of a method.
                                    Also, congrats on finding errors in my hastily typed tutorial!

                                    Game-runner of Silent Heaven, a small-town horror MU.
                                    https://silentheaven.org

                                    JennkrystJ 1 Reply Last reply Reply Quote 0
                                    • JennkrystJ
                                      Jennkryst @Jumpscare
                                      last edited by Jennkryst

                                      @Jumpscare said in Learning to Code - A Sprite Break:

                                      @Jennkryst
                                      Where is that code? Where’s the }? I need to see more. When asking for help on errors, it’s best to post the entire method that the error comes from.

                                      So this is what the bit in characters.py looks like:

                                      self.db.characteristics = {
                                          "Agility": 1,
                                          "Brawn": 1,
                                          "Cunning": 1,
                                          "Intellect": 1,
                                          "Presence": 1,
                                          "Willpower": 1
                                      }
                                      

                                      Now, in terminal:

                                      (evenv) jennkryst@Ubuntu:~/muddev/FFGTest$ evennia start
                                      Traceback (most recent call last):
                                      File “/home/jennkryst/evenv/bin/evennia”, line 11, in <module>
                                      main()
                                      File “/home/jennkryst/evenv/lib/python3.10/site-packages/evennia/server/evennia_launcher.py”, line 2344, in main
                                      error_check_python_modules(show_warnings=args.tail_log)
                                      File “/home/jennkryst/evenv/lib/python3.10/site-packages/evennia/server/evennia_launcher.py”, line 1766, in error_check_python_modules
                                      _imp(settings.BASE_CHARACTER_TYPECLASS)
                                      File “/home/jennkryst/evenv/lib/python3.10/site-packages/evennia/server/evennia_launcher.py”, line 1733, in _imp
                                      import(mod, fromlist=[fromlist])
                                      File “/home/jennkryst/muddev/FFGTest/typeclasses/characters.py”, line 16, in <module>
                                      self.db.characteristics = {
                                      NameError: name ‘self’ is not defined

                                      But it sounds like your indentation might be wrong and you’ve wandered outside of a method.

                                      I also forgot a space in there, fixed it, but the problem persisted.

                                      Also, congrats on finding errors in my hastily typed tutorial!

                                      The terminal deserves all the credit, it pointed me at the line in question, I just stared at it until I figured out why. But thanks!

                                      … also, I’m sure I have more issues than just figuring out the self.db problem, but.

                                      Mummy Pun? MUMMY PUN!
                                      She/her

                                      D 1 Reply Last reply Reply Quote 0
                                      • D
                                        dvoraen @Jennkryst
                                        last edited by

                                        @Jennkryst Is this code snippet just hanging out by itself in characters.py? If so, that’s the source of your error. It’s hard to diagnose your error without seeing your code in full. I presume this snippet is supposed to be in, say, at_whateveritscalled_creation().

                                        JennkrystJ 1 Reply Last reply Reply Quote 0
                                        • JumpscareJ
                                          Jumpscare
                                          last edited by Jumpscare

                                          @Jennkryst
                                          You might’ve missed me saying it, but it needs to go in the at_object_creation method.

                                          A method is any of those lines that start with def. All of your code in characters.py, rooms.py, exits.py, scripts.py, accounts.py, channels.py and objects.py needs to go inside methods. And methods go inside the class that the file defines.

                                          For the most part, all of your def lines should be at the 1st indentation, and the code inside at the 2nd indentation and beyond.

                                          class Character(DefaultCharacter):
                                          
                                          
                                              def at_object_creation(self):
                                                  """
                                                  Called only at initial creation.
                                                  """
                                                  self.db.attributes = {
                                                      "Grit": 2,
                                                      "Presence": 2
                                                  }
                                          

                                          Code in commands/commands.py is different and each command is its own class.

                                          class Sayhi(Command):
                                              """
                                              Tells the character hi.
                                              """
                                              key = "sayhi"
                                              aliases = ["sayhello"]
                                              lock = "cmd:all()"
                                              help_category = "General"
                                          
                                              def func(self):
                                                  self.caller.msg("Hi!")
                                          

                                          And the command needs to be added to commands/default_cmdset.py. Most of the lines below should already be in your file. What you add are the first and last lines.

                                          from commands.command import Sayhi
                                          
                                          class CharacterCmdSet(default_cmds.CharacterCmdSet):
                                          
                                              "key = "DefaultCharacter"
                                          
                                              def at_cmdset_creation(self):
                                              "Populates the cmdset"
                                              super().at_cmdset_creation()
                                          
                                              self.add(Sayhi())
                                          

                                          Game-runner of Silent Heaven, a small-town horror MU.
                                          https://silentheaven.org

                                          1 Reply Last reply Reply Quote 0
                                          • JennkrystJ
                                            Jennkryst @dvoraen
                                            last edited by

                                            @dvoraen said in Learning to Code - A Sprite Break:

                                            @Jennkryst Is this code snippet just hanging out by itself in characters.py? If so, that’s the source of your error. It’s hard to diagnose your error without seeing your code in full. I presume this snippet is supposed to be in, say, at_whateveritscalled_creation().

                                            Yeah, it’s hanging out by itself, so I thought that was the code in full.

                                            @Jumpscare said in Learning to Code - A Sprite Break:

                                            You might’ve missed me saying it, but it needs to go in the at_object_creation method.

                                            It’s more ‘I read what you said and then assumed I knew what you meant by it’.

                                            …

                                            Alrighty, the game is starting again, all new errors are being thrown client-side, so I’ll see if I can figure those out before checking back here.

                                            Mummy Pun? MUMMY PUN!
                                            She/her

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post