If your system has many currencies, this script will allow you to manage them. The commands are as follows: !xe Print the command help !xeconvert X A to B Convert X of currency A to currency B. It will try and find the most direct path from currency A to B, this path may not be the most money-efficient path, it's only guaranteed to be the path with the least amount of steps. !xeset A equals X B This sets the system up, so that 1 A = X B. If the inverse has not been set, it will be set automatically, if the inverse has been set, it will not be changed. If X is the special value 0, conversion is not possible from A to B. Note however that conversion will try and find a way around this block, this is intentional. Other utility functions such as import, export, delete and reset are available as well. Example: Let's take this fictional world with four currencies: A, B, C and D. 1 A = 2 B. The kingdom of B does not want to trade back to A however, so we type: !xeset A equals 2 B !xeset B equals 0 A The kingdom of B has no problems trading with the empire of C however, nor is there an issue the other way around: 1 B = 3 C, 1 C = 0.333... B Because the inverse is automatically put in if we only need to type: !xeset B equals 3 C Now let's say the situation between C and D is similar to that between A and B: 1 C = 0.5 D, but the inverse is forbidden. !xeset C equals 0.5 D !xeset D equals 0 C And to finish it off, 1 A = 3 D, and the other way around is just fine: !xeset A equals 3 D Now say we want to convert 1 A to B, so we type: !xeconvert 1 A to B It will tell you that 1 A equals 2 B, as you would expect. But now if we type: !xeconvert 2 B to A You might not have expected it to say that 2 B is indeed 1 A, since trading from B to A is forbidden. However, if you look down you'll notice that it went from B to C to D to A, none of which are forbidden. Technical details: When you try a conversion, it will first try the direct route, if that is not possible, it will convert the internal structure to an adjacency matrix, and will then apply Dijkstra's Algorithm to the resulting graph. This is guaranteed to give the shortest path, if no path is found even then, it will tell you that there is not conversion possible. This particular implementation runs in O(E log(V)) time, where E is the edge count, and V is the vertex count. This is provably optimal. Download: Here: <a href="https://gist.github.com/Villadelfia/781097f9a87e2e" rel="nofollow">https://gist.github.com/Villadelfia/781097f9a87e2e</a>...