Re: prioritizing and remembering
For the first issue, you can use an array and store the buttons as they are pressed. Here is a good website for learning about arrays: http://robodesigners.blogspot.com/2012/04/arrays-in-robotc.html
For the second issue, you can sort the array right before you proceed to a floor. There are a lot of programming techniques for sorting, the easiest of which would be http://en.wikipedia.org/wiki/Selection_sort
. It is not the most efficient way of handling it but it would work. It would be problematic if you are above the lowest floor set, though, as it would travel all the way to the bottom before proceeding back up. I would handle this by putting the current level in an array with all of the values higher than it (sorted from the lowest, which should be the current floor, up to the highest) and creating another array with all of the lower values (sorted from the lowest floor up to the closest floor to the current one). This may not be the most efficient way to solve the problem, though.