Description
It is possible to run tests in which users are challenged to place prims in predetermined places, being scored at the end of the test by how closely their placements match a specific target.
This is achieved by creating two save files: an initial state, which is presented to the user at the start of the test; and a target state, which represents the "ideal" positions of all prims.
These tests may form part of a multiuser setup by being attached to "seats" in the normal manner.
Use
The user clicks a "!teststart <initial state>" button to start the test, and the initial state is created. When they have moved the prims to the best of their ability, they click a "!testend <ideal state>" button and scoring is performed.
At the end of a test, that user's results are displayed on any associated scoreboards, as well as being sent to any associated mailbox.
Scoring
The score consists of a percentage and a time in seconds. The time is simply the elapsed real time between the start and end of the test. The percentage score, however, deserves closer examination. The method is as follows:
Firstly, the script builds up two lists: one of all the prims in the target save file, and one of all the associated prims as they are now. The positions of the prims are recorded in these lists.
For each prim in the save file, the script looks for the nearest prim that has the same name in the current positions list. Having found that prim, it is deleted from that list (and hence unavailable for subsequent comparisons) and the distance between the two is added to a total. If the distance exceeds a previously recorded maximum distance, that maximum distance is used instead.
The internal name for the maximum distance is TestMax, and it is derived from a like-named entry in the ML config file by default, although this can be overridden (see below).
When all prims are processed, an average is derived by dividing the total distance by the number of prims that have moved. Prims that are in precisely the same position are deemed not to have taken part in the test and are ignored.
The percentage is then calculated as follows:
((TestMax - AverageScore) / TestMax) * 100
Setting TestMax (maximum distance)
The user can set their own maximum distance for a test. This is achieved via a button called "!testmax"; clicking that button, then in two different places on any ML surface, will measure the difference between those two places and store that as the value of TestMax
Note that the TestMax value is stored in save files and restored when a save file is loaded.