Best Way to Clean Up this Small Section of Code?

Best Way to Clean Up this Small Section of Code? Will be adding about 50 more of the String Values and it will be a mess.

You could use the “Starts With” blueprint node, and then just have it look for the prefix to your string of “Road”, instead of generating the 3 separate tests.

But this assumes that the “road” number is not important. if the road number is important, then the “starts with” will not work if there are other “Roads” that you are not attempting to detect.

If you have many other roads, then the best way would be to group the roads with a unique prefix, such that you could test for that prefix, and know with 1 test, if it was the group you were looking for.

The only other way to “clean up”, would be to write a Macro to take the input, and perhaps hard code inside the macro, the “Roads” or to pass to the macro the string for the roads. But this does not “clean up” the code internally, as the same amount of code is going to be generated via the macro.

The best way would be to group the roads with a prefix, and then test for that prefix. This will actually clean it up, and reduce the amount of “p-code” that is generated for the Virtual Machine that runs the blueprints.

Hope this helps,

Just tested and it works perfect, great idea, thank you !