Hi, I am making a game tittle textbox that plays a certain sound if the number of characters increase or decrease, but I have a problem.
the issue is that: the sound 2d is supposed to stop playing after a delay, the delay is the current number of characters in the textbox - last number of characters in the textbox.
if I type “im awsome” in the textbox, that’s 9 characters.
(number of characters in textbox are integers)
the minus node should do 9 - 0, I used a print node to see what the computer was getting: 0. Yes, the computer thinks 9 - 0 = 0!
Maybe it’s my coding, or my computer is dumber than a rock.
Holy mother, that is a mess of BP!!!
Ok, so have you started simple like printing out the length at the very beginning of the chain? Clearly 9-0 is not going to give you 0 so it’s more likely that your chain of events is masking an issue.
while waiting I tried to debug by doing a bunch of print strings.
yes i know it’s a big mess, ima add comments later lol.
for some reason after uploading that post, the minus actually worked?!
then I coded it to print: “sound stop” when the delay ended, but the sound kept on playing after “sound stop” was printed
you almost got the point, last_length_1 = current length because the next time the player edits the textbox, the computer will need to get the length of the last edit, to know the increase/decrease in characters.
bassicly, by the time last_length_1 is set, last_length_1 would have already been used for purposes i needed it for.
if last length was changed before anything happened, I would probobly get a 0!
I just have to fix the audio not stopping problem, ima make another post for that.
oof, man. I know it’s not what you asked, but I got to say something. Home dawg, clean up that graph!
lol, it’s not about tidiness for tidiness sake. You will get waaay more confused about your code if you don’t keep the graph orderly. It’s gonna get very difficult to debug, or like you are experiencing right here - simple problems can seem complicated if you dont have a graph that is friendly to the human eye.
CHeck this out for guidelines:
GitHub - Allar/ue5-style-guide: An attempt to make Unreal Engine 4 projects more consistent
or if you want easy mode, I highly recommend the marketplace asset called “blueprint assist.” That makes it so that you can just press one button and the graph organizes itself neatly.
It’s a really good idea to use the reroute nodes to tidy up your blueprints. Click “Add Reroute Node…” from the right-click menu to add one. It’ll let you straighten/branch out your wires a lot nicer.