# Ive created a function telling you how long until your rivals match your masters levels, or a set target (locked)

5 posts

 const timeToMax = (rival, m1, m2, m3, target=-10) => { [m1,m2,m3] = [m1,m2,m3].sort((a, b) => a > b ? 1 : -1) let totalTime = 0 if (rival >= m3) return 'Rivals level too high' let messages = [] while (rival < m3) { let expNeeded = rival*10+10 let expPerMin = Math.max(m1-rival, 0) + Math.max(m2-rival, 0) + Math.max(m3-rival, 0) totalTime += expNeeded/expPerMin rival++ if (rival == target) return (`\${totalTime.toFixed(2)} minutes until the target rival level of \${target}.`) if (rival == m1 && m1 != m2) messages.push(`\${totalTime.toFixed(2)} minutes until rival reaches \${m1}`) if (rival == m2 && m2 != m3) messages.push(`\${totalTime.toFixed(2)} minutes until rival reaches \${m2}`) if (rival == m3) messages.push(`\${totalTime.toFixed(2)} minutes until rival reaches \${m3}`) } return messages } How do I use this ? The above is JavaScript code, you can paste it in to the developer tools to then use it. Right click on this page Click inspect Click console on the top grey bar in the area at the bottom that just opened Now press either Ctrl+l or click the no entry sign, this will tidy things up Cope the above code from before the const to the end of the last } Paste it and press enter Now you can use it It has two uses. If you now type in the developer tools the name of the function which is timeToMax and either four or five numbers in it as shown below. Four numbers like this timeToMax(100,200,300,250), I have entered first the rival or founder's level, then the 3 levels of my masters. It will tell you how long until your rival/founder will reach each of the masters levels. If you instead want to set a target level do the same except put a fifth number at the end, this will then tell you how long until your rival/founder reaches that target level. Here is a screenshot of it here working as intended in the console: https://i.imgur.com/56IrAAy.png Do you plan on modifying this for use with cofounders that have at least 10 special trainings done and/or for leveling rivals outside of their home region? The code here is missing the (`) signs from the imgur pic and wasn't working. Adding them in made it work. Any plan to update with Xander taken into consideration? > *Originally posted by **[szig](/forums/951337/topics/1878166?page=1#13301224)**:* > Any plan to update with Xander taken into consideration? Coincidentally the project I just started has what you're looking for. It will eventually have calculators/timers for other features/games but this is what I started with. It's not pretty yet but it works (kind of. You'll have to refresh the page to use the Calculate button more than once. I'll probably fix that tomorrow.). https://exadi.github.io/idle-timer/