Don’t forget we moved!
https://brandmu.day/
Learning to Code - A Sprite Break
-
As someone who has tried to teach a number of people how to code, let me just say–
No, I will not be doing that anymore. There’s only, let’s be honest, a small handful of people who overlap on the Venn diagram of ‘good at code’ and ‘good at teaching’, because these are TWO VERY SEPARATE skills.
And of those people, a lot of them have been burned by people posing ‘teach me how to code’ as basically asking for ‘do all the coding for me, but while explaining every step and why you’re doing it that way, so it makes it 10x slower’.
-
@Wizz said in Star Wars Age of Alliances: Hadrix and Cujo:
Not to pile on you and I don’t want you to feel discouraged or attacked
I am attacked, halp
but repeatedly asking someone here either to code for you or teach you to code when it’s actually a much larger investment of time and effort than you seem to be treating it – especially in pandemic times – is not gonna win any hearts and minds.
@Roz said in Star Wars Age of Alliances: Hadrix and Cujo:
Yeah I was kind of typing this, but Wizz beat me. Asking for someone to basically teach you through the coding of a game is actually going to be more work for them than just having someone code a system yourself.
You have both seen through my clever ruse of ‘this would be easier to just do myself instead of trying to teach her anything’!
(I mean, that wasn’t the original intent, but it’s funnier to me if I pretend it was)
You’d probably be able to find folks willing to answer questions when you get stuck – I know both Ares and Evennia have active Discords – but it’s gonna require you doing the heavy lifting yourself.
Nobody wants to answer questions like ‘wait… I need linux to make this thing work?’ and ‘what do you mean, put a virtual machine on my normal laptop?’ Which is totally fair on them for not wanting to deal with basic-ass questions.
… but it took me like two weeks to figure them out, back in 2011, after the first time AoA died and I wanted to make a replacement.
@Meg said in Star Wars Age of Alliances: Hadrix and Cujo:
As someone who has tried to teach a number of people how to code, let me just say–
No, I will not be doing that anymore. There’s only, let’s be honest, a small handful of people who overlap on the Venn diagram of ‘good at code’ and ‘good at teaching’, because these are TWO VERY SEPARATE skills.
And of those people, a lot of them have been burned by people posing ‘teach me how to code’ as basically asking for ‘do all the coding for me, but while explaining every step and why you’re doing it that way, so it makes it 10x slower’.
Would you consider ‘here is what I wrote, plz tell me why it is dumb’ and then you point out where I put ,. Instead of ., and that caused the world to implode?
Good ol’ Robert’); DROP TABLE students;–
(Also take all your upvotes in exchange for dealing with me whining, because this is the equivalent of spritzing me with a water bottle and calling me out, and it is actually a decent way to keep me on-track to figuring shit out on my own (my brain, why))
Now back to how Cujo and Hadrix are the worst.
-
@Jennkryst said in Star Wars Age of Alliances: Hadrix and Cujo:
Nobody wants to answer questions like ‘wait… I need linux to make this thing work?’ and ‘what do you mean, put a virtual machine on my normal laptop?’ Which is totally fair on them for not wanting to deal with basic-ass questions.
This simply isn’t true. I have both asked questions this basic of the Ares discord, and answered them myself now that I know what I’m doing more thoroughly.
People are very willing to help - but in the sense of someone who is coming in having done what they can on their own, who’s willing to dig in, read the tutorials, try some things, ask questions as needed, try to figure it out on their own, ask questions as needed, repeat.
Sometimes ‘what they can do on their own’ really is ‘almost nothing’ and we can give them a boost to get to ‘something’. But a boost is still real different from asking someone to teach you to code, or to code it themselves.
The real forward motion still has to come from you.
-
@Jennkryst said in Star Wars Age of Alliances: Hadrix and Cujo:
Would you consider ‘here is what I wrote, plz tell me why it is dumb’ and then you point out where I put ,. Instead of ., and that caused the world to implode?
Yeah, if I were asked to just review code that was written? Or try to help find a problem that exists in the code you wrote and figure out why it’s not doing what you want?
That is so much funner and less stressful than walking someone through the process of writing the entire thing. For me, personally.
-
respectfully what is happening
-
@Pax Fair - maybe a mod could split this out into a ‘learning to code’ thread or something?
-
@Pax Just another sprite break, while AoA makes another problematic decision and/or votes for the next
victimrepresentative to send over andsacrificedtry to defend staff choices. -
-
This post is deleted! -
-
-
-
-
@Jennkryst said in Learning to Code - A Sprite Break:
I am attacked, halp
To echo what @Tat said - it’s not true. I have a mountain of tutorials on Ares to teach people how to code, and am more than happy to answer even basic questions on the discord.
Unfortunately, Ares is not really well-suited for the type of game/code you’re looking for But I just wanted to provide a counterpoint that people willing to teach others how to code (within reason - I can’t do it FOR you) do, in fact, exist.
That said - online resources are better than ever and then you don’t have to rely on anyone’s good graces.
-
-
-
Yes, thank you. Evennia is why I linked a helper to Python.
-
Does this include web hosting and wiki stuff? I just bought a domain for a Hunter game I’m starting. I’m sure I could figure out wiki skinning if I just knew WHERE TO GO. I have hostgator and installed MediaWiki, I just don’t know the next step.
-
@catzilla The extent of my wiki code knowledge is ‘that page looks pretty, let me copy the code and fiddle with it until it looks right for my character vibe’
-
@catzilla It depends what you mean by wiki skinning? This has links to various MediaWiki skins and how to install them (which is generally just downloading a bundle of files to the /skins/ directory in your MW directory and then copy-pasting a line of code into your LocalSettings.php). If you mean how to customize a skin, then you’ll generally want to either edit MediaWiki:Common.css or your skin’s CSS file on your wiki itself (so it’ll be like https://yourwikiurl.com/blahblah/MediaWiki:Common.css, or https://yourwikiurl.com/blahblah/MediaWiki:SkinNameHere.css). Common.css overrides the CSS on any skin a viewer may use (since there are usually a few installed by default and users can technically switch around), while the individual Skin.css files will override just that skin. Most game wikis are basically designed around a single skin so you can probably just use either. You can even comment out the lines where any other skins are activated in LocalSettings.php. Using these on-wiki CSS sheet is preferred over trying to edit the raw skin files themselves, since changes there would be potentially overwritten if there were any updates made to MW or the skin.
-
@IoleRae said in Learning to Code - A Sprite Break:
Python:
That’s where I send interested teens, and it seems to do the trick.
Never going to get past the second level, because it won’t let me pet the dog. RIP all my planz.
-
@catzilla To do hosting and system administration stuff properly you need a minor course in unix
Gotta be one on freecodecamp
https://www.freecodecamp.org/news/the-linux-commands-handbook/
-
Evennia has a lot of tutorials, but they’re geared at the basics, not what you’d actually want in your game.
So here’s one where I write the code for you and tell you want to do.
Lesson 1: Make skills and roll modifiers for your characters.
Disclaimer: I typed this all up from memory. It’s probably got a few typos, so I trust you to be able to figure out what’s wrong, by looking at adjacent code and making yours look just like the code that’s next to it. One of the most valuable skills you can learn is figuring out what to do when your code spits out an error. Make errors early on! The site Stack overflow is your friend, too.
So you have Evennia running. You can log in as your admin account. You have access to the command line.
First, pull up characters.py in your game directory.
Now, set up your skills as a dict, in characters.py, in the at_object_creation method, which should be near the top.
self.db.skills = { "Medicine": 1, "Underwater Basket Weaving": 1 }
Your skills won’t automatically get added to existing characters, so you’ll have to create a method to add them manually, or reload your character object. Reloading your character object resets ALL attributes to what’s in at_character_creation, so make sure you only use it when you’re fine with resetting your character back to nothing. Check the Evennia documentation for how to do this. I don’t remember offhand, since it’s been over a year since I’ve reloaded an object.
Once you get your skills on your object, you can reference them easily. Here’s an example line. Don’t add it anywhere yet.
self.db.skills.get("Medicine", 0)
The zero at the end says that if the Medicine skill isn’t found, default to zero.
You can run python lines as your admin account while being logged in.
Try typing:
py self.msg(self.db.skills.get("Medicine", 0))
This should message (msg) your character the value of its Medicine skill.
Now, let’s add buffs / debuffs or other roll modifiers. Once again, add a dict of modifiers to your at_character_creation method:
self.db.modifiers = {}
It can go just below your skills dict.
Now we need a method in your character class to add modifiers.
First, add this to the top of your characters.py file.
import time
We do this because we need to know the time for this part. It’ll make sense eventually.
Next, add this to the bottom of your characters.py file.
def add_mod(self, name, value, effect, duration): # adds a value to a modifier, value can be negative for a debuff # name is the name of the mod, e.g. "Squeamish" # value is how strong this mod is, e.g. 2 or -4 # effect is the skill or other roll it targets, e.g. "Medicine" # duration is how long it should last, in minutes # get the strength of the current_mod current_mod = self.db.modifiers.get(name, 0) # update or set the value of the modifier self.db.modifier[name] = (current _mod + value, effect, time.time() + duration * 60) # What does the above mean? # We're adding a list of 3 entries to self.db.modifier, using the name of the mod as the key # current_mod + value is our new value # effect is set without change # time.time() means to get the current numeric time, and we add to it the duration we set, but we multiply the duration by 60 because the duration is in minutes, but time.time() is in seconds, so we need to convert it
A line that begins with a # is a comment. Read the comment lines above to learn what this method is doing. There are only two real lines of code in that method. The rest are comments explaining what’s going on.
If you want buffs & debuffs that don’t stack, you can alter the above code by removing the current_mod code. This will set static values so that your +2 Holy Weaver buff doesn’t stack to a +4 the second time it’s used in succession. If you want both cumulative and static buffs, make two methods. Alternatively, add a “stacking” flag to the method and set stacking = True or stacking = False, then add a little check for whether or not it should stack, setting current_mod to 0 if it doesn’t stack.
Now, modifiers don’t expire on their own. We need a method to expire old modifiers. This method has only 3 lines of code, but again, I’ve commented it to explain it all.
def expire_mods(self): # check all mods and remove any that have expired # first, iterate through all keys in the modifier dict for mod_name in self.db.modifiers: # check if its expiration time (entry 2 in the mod's list) is before the current time # We're iterating on the keys of self.db.modifiers, not the lists, so we need to use .get to get the list, and pull out entry [2], the expiration time, then compare that to the current time. if self.db.modifiers.get(mod_name)[2] < time.time(): # if we're here, then we've confirmed that a mod is old and should be removed, so let's .pop it out of there self.db.modifiers.pop(mod_name)
There’s only one last thing you need: a way to check skills with their mods. Again, this method is only 2 lines, but commented a bunch:
def get_skill(self, name): # First, expire old mods. We don't need to check for expiration and removal at any point up until now. self.expire_mods() # There are no arguments with this, even though the expire_mods method has "self" as an argument. This is because "self" is automatically sent for any method call, regardless of whether or not you want it to be sent. # Next, pull the value of the skill out of the skills dict, and add the value of the corresponding mod from the modifier dict # If the mod is negative, you'll be adding a negative, which is just subtraction, so this accounts for buffs and debuffs. return self.db.skills.get(name, 0) + self.db.modifiers.get(name, 0)
In your commands.py, add a command to test your code.
class ListSkills(command): # Type "skills" to use this command key = ["skills"] def func: # Set our message to be a blank string. message = "" # The "self" from characters.py is now "self.caller" since we're "calling" this command. for skill in self.caller.db.skills: # We're creating a string that will eventually be sent to the player. We can add additional text to that string with +=. The code \n means to go down one line, as if you pressed enter. message += "Your " + skill + " skill is at level " + self.caller.get_skill(skill) + "\n" # We now have a string that lists the names and values of each skill, one per line. Let's send this message to the player. self.caller.msg(message)
Whenever you add a command, you need to import and add it to the default_cmdset.py file.
from command.commands import ListSkills
And then further down the file near the “super,” add something like this:
ListSkills.add()
Now at your command prompt, type:
Evennia restart
If you get no errors in the command line of your logged in character, type “skills” and press enter, and look at your beautiful skills.
Congrats, you now know about 80% of what it takes to code in Evennia.
If you do this lesson and you’re still confused about any errors or lines of code, feel free to ask me and I’ll be happy to help.
-
@Jumpscare None of this tells me how to pet the doggy in code combat, the new limbo I am stuck in.
(actually trying to figure out Virtual Box, since I do not have Hyper-V)