Lemme try and explain. And by that I mean: "Let me try and write down what just happened for reference." The shop screen is possibly my biggest menu-based nightmare, because if I don’t do it efficiently, it’s, A: gonna be near- impossible to update, B: near-impossible to understand, and C: gonna take forever. And even if I DO do it efficiently, there’s a massive chance for huge amounts of bugs.
So… I properly started it about 3 hours ago. That is, importing all the graphics, arranging them, and creating some events. The import was fine, and it looks great. Unfortunately… then came the events.
I didn’t know where to start, so I thought I’d get one of my biggest fears out of the way – the item browser. When you click on a weapon/utility slot, it should reset the item list, and bring up a new list filled with all the unlocked items of the type you chose. I got the menu item borders to appear no sweat, and I even made them slide down for effect. And then came… the text.
Making strings follow certain objects when meeting certain conditions has always been one of my biggest failings. And the reason? Strings are UNABLE to hold alterable values. Variables. "Hidden numbers". And they’re critical. When the list is created, every item border is assigned an ID which is stored in an alterable value, and that’s how the strings know which item border they "belong" to. Well… that’s how they WOULD know… if they could store alterable values themselves. But the string can’t store AV’s… so there’s no way of knowing which border it belongs to.
It’s pretty head-spinning. It would have been a piece of cake in C#… but this isn’t C#. I thought about how I’d do it… but not much was coming to mind. I tried a special object, the "Value Add" extension, which gives all objects unlimited alterable values… and that worked to a certain extent… but whenever the list size was above 2, it screwed up almost completely. The strings would all bunch together in the last item box… which is sort of wrong.
Then… just as I was about to give up… I noticed something in an expression for that Value Add extension. "Fixed value". I didn’t know what it was talking about… until I had a look at what data I could get from a string. A "Fixed value"!
"HOLY FUCK, FIXED VALUES?!" I said. "EVERY OBJECT HAS A FIXED VALUE?! Why have I never noticed this before?! This changes everything!"
I immediately knew what I had to do. I caused the fixed value for each newly created string to be stored in alterable values in each new item border object. Yes, a bit of a mouthful, but I can’t really explain it any better. That automatically created a link between the item border and its strings that I could use. Created a condition, "If ANY item border’s ‘PairedWithItemNameString’ is equal to the fixed value of ANY object ‘Item Name List Item String’, then change it’s position to be inside said item border." Worked perfectly.
So… all in a day’s work. Now… tomorrow, I’ve gotta make it so you can SCROLL through this list.