Smooshing stuff together until it works

9
Official Construct Team Post
Laura_D's avatar
Laura_D
  • 25 Sep, 2020
  • 383 words
  • ~2-3 mins
  • 939 visits
  • 0 favourites

In last week's post, I spoke about the design for the final iteration of my crafting system. I'm happy to say, it's progressing well, but I'm at the stage where I'm starting to have to rework my two test projects to make them speak to each other properly. Or, smooshing them together until they work!

The fun started when trying to ensure my dictionary and arrays updated correctly when crafting a new item. The crafted item needs to be added to the inventory while its ingredients need to be removed. The functionality already exists in the inventory portion of the test project, but it needed to be adapted to include the crafting mechanics.

That meant creating new functions which was easy enough. Until they didn’t work. And thus the smooshing began.

The events worked on their own, but for the life of me I couldn't figure out why they suddenly didn't as a function. I tried changing my event order, creating whole new event sheets (which I should have done to begin with anyway but that's another story), even recreating the events from scratch. All of the smooshing techniques I could think of. But I could not get them to work together. And then it hit me – I needed parameters.

The events in the functions were still specific to the inventory mechanics – passing through values that didn't exist in the crafting event sheet. I needed to change the functions to make them non-specific. This is where the parameters come in handy. Both the inventory and crafting systems need to access Item names and IDs but they're different in each circumstance. So the parameters allow the use of different values where I need them.

As an aside, I am grateful that functions no longer scare me. They are SO useful! If you've never used functions, take a look at the manual entry and try using them in a project or two. They're a great thing to master!

This all means that this tester project is almost done. The functions are almost all updated and the basic functionality is all in place. Then it's just a case of tidying and writing the accompanying tutorial. Once I get it all working, I might share the completed test with you guys. So wish me luck!

Subscribe

Get emailed when there are new posts!

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!