Hi there! So as some of you might know I “recently” (half a year ago) started coding a MCDU Tool for a Roblox Flight Simulator! And it by now has a ton of functions and a lot of users (120+ People are in my MCDU Server) which also especially as I am a rather messy coder means that the code is huge and was already too big for the meowbit 4 months ago! And I know a lot of my code is simply just made in the way I know I can do it (not compact at all… giant and yeah) so basically the game has like 80 planes and I made an option for each of them… I do not know how to make this code any shorter!
Same for this whis is the runway numbers! Why so many numbers you may ask? Well the runways are named by the heading of the runway in the landing direction so 36L for example means heading 360 (North) and the L stands for Left as there often is 2 in the same direction which then are named Right and Left!
Anyways! Please help me shorten the code a little! If I need any more help for this Ill post it here!
Thanks!
you but to use this in new ways you must know how “index of” function work
so here is my breath explanation
The indexOf() function is useful when you need to determine the position of an element within an array, or when you need to check if a specific element exists in the array. It provides a convenient way to perform array searches in MakeCode Arcade.
So basically, it’s like “print()” in python. It prints the data you enter to the “console” and the “data simulator”. You can only open the data simulator if you have console blocks in your code. To open the console, press MENU and select SHOW CONSOLE. It will provide a place for the output on the screen.
NOTE: If you open the CONSOLE (not the data simulator) it will only show outputs that are given after you open it.
This is a very useful function, I use it a lot!
Yes I do recall doing something like this with the indexOf block I simply do not know how to do it!
I think something with the repeat (length of array) the problem is: The runways for example are not all in a single array but rather the runways are in an arrray of the airport. For example: IRFDrws (Greater Rockford International Runways) are 36L 36R 18L 18R (its 2 runways but 36 is if landing towards north and 18 is landing towards south R and L are then Left/Right depending on where you are comming from)
Theres multiple airports with 1 or 2 runways each which are almost all different headings…
Similar for the planes! They are not in an array at all… so I dont know if its even possible but I believe there is a way (I just dont know the way) thats why I ask you