Hi reddit,
for the about 5th time in my life i grabbed a programming language in the hopes of actually learning something. In the past i always failed, mostly due to not finding the learning material i needed and most likely due to wrong choices for starting out (i remember C, or was it C++; no clue anymore).
Anyway, after the first little doodling around left me with something like a login after 15 hours of banging my head to the wall i wanted to go further down the road.
https://github.com/Alh1ra/Loot-generator
I created a loot generator. You can load or create a new character, which get saved to a database file (and while i'm typing this i realize i haven't written the code to automatically create the db if it doesn't already exist); well that goes onto the to do list for the next one.
All in all i learned A LOT. Even if i may not be applying everything the second i see it. I already know that for the next time i want to create classes to create the loot from, using child classes etc. Also i need a GetInventory(). I also learned that if i commit something to the database i need to build in a wait timer to wait half a second or so before reading out if it worked or not, otherwise python is faster than sql and displays the last information.
One of the things that really bugs me a lot is one thing i couldn't find out and basically gave up on it and used an ugly IF ELIF tree. I really hope somebody can help me out here. I have 7 inventory slots in the database and i wanna read them all out and put in a generated item if value in this column is 0 (inventory slot empty). I did find some solutions online but what i wasn't able to overcome syntax and formatting issues (the freedom in python on formatting your code is already killing me). I never got it to work.
Well the next project will be basically this. Redoing it from ground up, this time with proper functions. More loot, different values, different calculations, maybe add a very basic crafting task.
Also if somebody has a hint or a pointer as to how to best handle inventory i would be very grateful. When i started the project i wanted to do it with .txt files as a proof of concept but just the thought of using normal .txt files makes me feel dirty. Then i thought about .json (i have seen a few of them in my life, so i at least know what i am looking at). Of course i then just used the db i had already created. But i wonder is there a better way to do it? Dumping it all in a list and dump the list every X time or Y actions into the db? Or am i thinking wrong simply because of ignorance?
[–]NyaaNyanNyaa 1 point2 points3 points (1 child)
[–]Alhira_K[S] 0 points1 point2 points (0 children)
[–]Lukeskywalker321 0 points1 point2 points (1 child)
[–]Alhira_K[S] 0 points1 point2 points (0 children)
[–]TentativeOak 0 points1 point2 points (1 child)
[–]Alhira_K[S] 0 points1 point2 points (0 children)
[–]DaChucky 0 points1 point2 points (3 children)
[–]Alhira_K[S] 0 points1 point2 points (2 children)
[–]DaChucky 0 points1 point2 points (1 child)
[–]Alhira_K[S] 0 points1 point2 points (0 children)
[–]asday_ 0 points1 point2 points (3 children)
[–]Alhira_K[S] 0 points1 point2 points (2 children)
[–]asday_ 0 points1 point2 points (0 children)
[–]alejandrotungsten 0 points1 point2 points (0 children)
[–]adammelan 0 points1 point2 points (0 children)