Let's get the generator working, eh?

So I can't seem to make my appointment today, issues with fuel. At least I can work on my Slime Generator, though. I'll have to figure something out for that other thing...

I'll start out today by writing the DBMan functions for retrieving bits and pieces for the first slime.

Starting with the Bodies.

Made a few bodies to test with.

Now for the queries, the place I historically make the most mistakes.

Alright, now I need to check marking exclusion checks, so that markings that are excluded by previous markings can not be added. There's an intermediary table that hooks one ID to another ID so I just need to return an array of any found then concatenate the array onto a larger array, whenever we do a roll on a new marking we check that array for matching IDs.

Hmm, looks like now I have to test it... ho boy.

First I will add a few ears, tails and wings... then start it up and watch it burn.

First; the spelling stenanks.

Then some of the missed edge cases, like a body not having any marking, etc available.

Well, the generator is generating...

There's a lot of work required for testing. A lot. I'll lock off all but one body type to start out and test with one. Once I am confident in it's ability to generate I will continue on to the actual saving to the DB part.

Disabled 2 of the three.

Now... testing.

One
Two

I am noticing some interesting things going wrong. There's transparency being generated where there shouldn't be any it looks like. R, G, B, A is being randomized where only R, G and B should.

Peculiar. It looks like we're adding the ALPHA channel to the start of the hex string somehow? Am I drugs? Is Godot drugs? How is this happening?

... Huh.

Uhhh, well, the color is fine. Why is the alpha at the start of the hex? Weird, I guess it's fine but I could have sworn it went at the end. I'll do a little test I guess.

So it is. Alright, not a bug. Moving on.

Three
Four
Five

Now I will re-enable the other two body types, seems like all the bits are generating correctly.

Six

I will have to add all the other data required for the slime before I go and process it, setting nulls where nulls should be and 0s and 1s wherever they need be as well otherwise the CREATE function in the DBMan will be very very large and cumbersome.

Seven

Yeah, that all seems to be as expected. I am sure I will find bugs in this thing down the line but they may lead to features so here's hoping.

The Default Slime, before generation.
The data's all there now. Just need the owner.
Owner is there now.

Welp, the CREATE function must now be written. Here comes pain.

id, name, level, experience, strength, agility, constitution, intellect, wisdom, charisma, 
	current_health, max_health, current_sp, max_sp, current_weapon_skillpoints, max_weapon_skillpoints, short_blade, short_blade_xp, 
	long_blade, long_blade_xp, axe, axe_xp, projectile, projectile_xp, thrown, thrown_xp, spear, spear_xp, face_sprite, hand_sprite,
	color, color2, color3, color4, color5, body_sprite, head_slot_id, main_hand_slot_id, off_hand_slot_id, care_logs, neglect_logs, 
	owner_id, attention, aura_color, aura_showing, body_color, discipline, ear_color, ears_showing, energy, exercise, fun, hand_color,
	happiness, health, heat, hunger, hygiene, knowledge, moisture, tail_color, tail_showing, thirst, trust, wing_color,
	wings_showing, aura_id, body_id, ears_id, hands_id, tail_id, wings_id, shown_marking_1_id, shown_marking_2_id, shown_marking_3_id,
	shown_marking_4_id, shown_marking_5_id
The Fields.
THE FIELDS

I hate past me for making so many fields in this table. If I ever meet that guy I'll kick his ass.

Hehehe >=3
func create_slime(slime_data:Dictionary):
	# Gets a dict from the generator, converts it to a query and fires it.
	print("Slime generated:")
	print(str(slime_data))
	print("Attempting to add to geru_geru...")
	var slime_creation := database.execute("""
		BEGIN;
		INSERT INTO geru_geru(
			id, name, level, experience, strength, agility, constitution, intellect, wisdom, 
			charisma, current_health, max_health, current_sp, max_sp, current_weapon_skillpoints,
			max_weapon_skillpoints, short_blade, short_blade_xp, long_blade, long_blade_xp, 
			axe, axe_xp, projectile, projectile_xp, thrown, thrown_xp, spear, spear_xp, 
			face_sprite, hand_sprite, color, color2, color3, color4, color5, body_sprite, 
			head_slot_id, main_hand_slot_id, off_hand_slot_id, care_logs, neglect_logs, 
			owner_id, attention, aura_color, aura_showing, body_color, discipline,
			ear_color, ears_showing, energy, exercise, fun, hand_color, happiness, 
			health, heat, hunger, hygiene, knowledge, moisture, tail_color, tail_showing, 
			thirst, trust, wing_color, wings_showing, aura_id, body_id, ears_id, 
			hands_id, tail_id, wings_id, shown_marking_1_id, shown_marking_2_id, 
			shown_marking_3_id, shown_marking_4_id, shown_marking_5_id
		)
		VALUES
		(
			%s, %s, %s, %s, %s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, %s,
			%s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, %s,
			%s, %s, %s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, %s, %s, 
			%s, %s, %s, %s, %s, 
			%s, %s, %s
		)
	""" % [
	slime_data["id"],
	slime_data["name"],
	slime_data["level"], 
	slime_data["experience"], 
	slime_data["strength"], 
	slime_data["agility"], 
	slime_data["constitution"],
	slime_data["intellect"], 
	slime_data["wisdom"],
	slime_data["charisma"],
	slime_data["current_health"], 
	slime_data["max_health"], 
	slime_data["current_sp"], 
	slime_data["max_sp"], 
	slime_data["current_weapon_skillpoints"],
	slime_data["max_weapon_skillpoints"],
	slime_data["short_blade"],
	slime_data["short_blade_xp"],
	slime_data["long_blade"],
	slime_data["long_blade_xp"],
	slime_data["axe"],
	slime_data["axe_xp"],
	slime_data["projectile"],
	slime_data["projectile_xp"], 
	slime_data["thrown"], 
	slime_data["thrown_xp"], 
	slime_data["spear"], 
	slime_data["spear_xp"], 
	slime_data["face_sprite"], 
	slime_data["hand_sprite"], 
	slime_data["marking_color_0"], 
	slime_data["marking_color_1"], 
	slime_data["marking_color_2"], 
	slime_data["marking_color_3"], 
	slime_data["marking_color_4"], 
	slime_data["body_sprite"], 
	slime_data["head_slot_id"], 
	slime_data["main_hand_slot_id"], 
	slime_data["off_hand_slot_id"], 
	slime_data["care_logs"], 
	slime_data["neglect_logs"], 
	slime_data["owner_id"], 
	slime_data["attention"], 
	slime_data["aura_color"], 
	slime_data["aura_showing"], 
	slime_data["body_color"], 
	slime_data["discipline"], 
	slime_data["ear_color"],
	slime_data["ears_showing"], 
	slime_data["energy"], 
	slime_data["exercise"], 
	slime_data["fun"], 
	slime_data["hand_color"], 
	slime_data["happiness"], 
	slime_data["health"], 
	slime_data["heat"], 
	slime_data["hunger"], 
	slime_data["hygiene"], 
	slime_data["knowledge"], 
	slime_data["moisture"], 
	slime_data["tail_color"], 
	slime_data["tail_showing"], 
	slime_data["thirst"], 
	slime_data["trust"], 
	slime_data["wing_color"], 
	slime_data["wings_showing"], 
	slime_data["aura"][0], 
	slime_data["body"][0], 
	slime_data["ears"][0], 
	slime_data["hands"], 
	slime_data["tail"][0], 
	slime_data["wings"][0], 
	slime_data["marking0"][0], 
	slime_data["marking1"][0],
	slime_data["marking2"][0],
	slime_data["marking3"][0], 
	slime_data["marking4"][0]
	])
30 minutes later...

Now to double back through and see what I screwed up.

Many crashes later;

This doesn't mean it actually worked, it does mean my values all line up though. Still got some funny bugs to sort out but it's progress.

Ah, there's a big bug.

But it is 5 now, so I better go make dinner.

This is a tomorrow problem. Or not;

UPDATE:

It's working

I put in some overtime, shit was driving me nuts, had to make it work.