Tips on how to troubleshoot?

I’m new here so I’m just learning the ropes now in the middle of flow jam (actually just happened to discover this site the day after it started by happenstance)- which is all to say, I’m learning as I go, and probably being way too ambitious with my very first game.

But I’m just wondering- are there any good tips for troubleshooting code? My biggest struggle seems to be that it takes me a long time to find bugs/problems. I’ve been playing the game while looking at the blocks for the affected objects and trying to see where things are triggering weirdly to figure it out, but sometimes I just can’t figure it out.

For example, right now, I’m trying to get the attacher to work with two different objects that I can attach and detach from hangers on the wall. Video below is of me watching the code for the backpack as I’m troubleshooting (there’s no other code outside this bundle yet):

Visually I’m not seeing anything fire that would cause it to detach- any good tips for how to find the problem?

Game is here if anyone wants to take a live look at the actual code on the backpack, hanger, etc. (just bear in mind it’s not done, so a lot of other things don’t function yet):

1 Like

Hello @larson103 - Good to meet you!
When code breaks in flowlab, it usually falls under three categories:
1 - Code blocks were made incorrectly.
2 - The code blocks were not connected properly.
3 - Flowlab’s internal code is glitching/bugging - out.

The first thing is to use basic, straightforward logic. Make sure you can see clearly what the code lines are supposed to do, and if you can say it in a coherent sentence, it’s most likely not issue #2. For example:
When the player collides with a spike object, the player will impulse upwards and subtract 1 from the life number.
The third issue can be tested pretty quickly. Refresh the tab and press play from the games screen, not the test-play editor mode. If it works then, you know it was just a minor bug or error.

Finally, if neither of those don’t work, the most common reason for code breakage is you chose a variable wrong or typed in the wrong thing. In that case, it’s just long amd tedious checking and double-checking. Believe me, it sucks. Once I had to check all 6 GigaBytes of my character script because he was moving incorrectly in my Terraria Remake.
-I hoped this helped! Let me know if you have any more questions. Some good people to go to are @JR_01, who won a flowjam basically because he’s on 16 hours a day. @ManiacPumpkin is pretty talented, as well as personable. @PixelPizza is also very good, but can overcomplicate things easily, lol. (No offense lol) @grazer is the creator but he rarely responds unless it’s integral or incredibly important. @R0CK is an insanely fast learner, but also new and charismatic.
Good luck on your flowjam!!!
-meburningslime.

4 Likes

Thanks for the welcome @meburningslime

By your descriptions it sounds like it’s likely #1 or possibly #2 (although I’m using similar code on other objects, so I suspect #1), so I guess it’s just careful close-checking for me.

1 Like

Also, attach blocks summon and then connect a piece. When you detach, the summoned piece disappears.

There’s a “what’s this?” Page for every block. Check that out for more information on the Attach Block.
Maybe try using extractors and the position?
Also your video is private, none of us can see it.

1 Like

Thanks for all the help- I managed to fix it.

I think the problem was the first item mounted on the wall was not an attached item but a regular item, so I had a destroyer block to get rid of it that was then doing something behind the scenes to screw up the "off’ signals from the attacher blocks even though it ended up causing a problem with the second item rather than the item being both detached and destroyed (weird).

But oh well- all good now either way.

[Edit: oops about the video setting too- guess I should call it quits for the evening]

1 Like

No problem. Glad I could help and get you introduced to the forums! Take a peek around while you’re at it. I own the realm of the off topic channels, lol.