I am trying to create an achievement system in the game and I want the script to be reusable for all the text so I don’t have to manually input it.
So I have a Data Table with all the achievement information on it and on my widget I want the text to find the correct row on the data table and display the name of the achievement.
My Data tables are names 00, 01, 02 etc. and my achievement text objects are named Achievement_00, Achievement_01, Achievement_02 etc.
I want to create a binding, and in that binding will be a script that will reference the self, get the name of the self.
The part I don’t know how to do is to get the suffix (the number), which will then call the correct number in the data table.
Any ideas how to get this to work?
Thanks in advance
There is a node that splits a string into an array of strings, breaking it at the character or character sequence you indicate.
I think it’s called “Split” (which only splits once into two pieces - there’s another one called Parse String Into Array or something like that which does it multiple times).
YOu could use the underscore character “_” as your splitter, and then just get array index 1 to grab the suffix number you just split off from the original string.
Perfect, this is exactly what I wanted. I knew this existed somewhere, I just couldn’t remember the name of it.
Okay turns out I haven’t entirely thought this through.
You wouldn’t happen to know how to call the correct text to find the correct row, currently my setup wouldn’t work to apply to multiple pieces of text.
I was hoping to reference the self, but the self is the widget rather than the text that was using the binding at that moment
I don’t fully understand. Are you always getting the ERROR returned instead of the data table row and name from the struct in that row?
No no sorry, that part of the script is working fine, but atm only TextAchievement_00 is getting fed into it.
I’m looking for a way where this text binding can be applied to all my TextAchievements without having to create a binding for each individual one. So I could use the same binding for TextAchievment_01 and it would automatically find 01 in the Data Table.
I am not sure if what I am asking is possible to be honest, I just know there is a more efficient way of doing this without creating an individual binding for all my achievements.
Okay I’m dumb as hell.
I didn’t need a binding at all, instead i’m assigning it to event Construct.
Just in case anyone needs to know, this is my current setup that works and can be used for everything in my list.
Thanks for the help Mightyenigma, really appreciate it