That was my next step but damn you went all out that looks amazing i just did mine raw html with a jquery function but your kicked it up a whole lot π
whatever.html
<h1>Mccodes Crime Chance Calculator</h1>
<p>
This was written in html css and jquery to calculate the success rates based
on the users level and there will.
</p>
<table class='table' style='text-align: center; width: 40%;' cellspacin='1' cellpadding='1'>
<tr>
<th>Users Level</th>
<th>Users Will</th>
</tr>
<tr>
<td><label for='level'>Level:</label></td>
<td><input type='number' min='1' value='1' max='100' id='level' required /></td>
</tr>
<tr>
<td><label for='will'>Will:</label></td>
<td><input type='number' min='1' value='100' max='99999' id='will' required /></td>
</tr>
<tr><td colspan='2'><input type='sumbit' id='btnclick' value='Find Percentage' /></td></tr>
</table>
<table class='table' style='margin-top: 10px; text-align: center; width: 40%; height: auto;'>
<tr><th>Result</th></tr>
<tr><td><span id='result'></span></td></tr>
</table>
I wrote a little bit extra that i was planning on implentnting into if people were to use on there game. so if enter over 1000 into the box it just jumps back to max level which is currently set in the jquery but i will test yours as soon as get a server running again π
$(document).ready(function() {
$('#btnclick').click(function() {
let level = $('#level').val()
let will = $('#will').val()
let crimeSuccess = calcChance(will, level)
crimeSuccess = crimeSuccess > 100 ? 100 : crimeSuccess
console.log('logged chance rate at ' + crimeSuccess)
$('#result').text(crimeSuccess)
})
$('#level').keyup(function() {
const maxLevel = 100;
let levelcheck = $('#level').val()
if (levelcheck > 100) {
$('#level').val(maxLevel)
}
})
$('#will').keyup(function() {
const maxWill = 99999;
let willcheck = $('#will').val()
if (willcheck > 100) {
$('#will').val(maxWill)
}
})
// Value 1 is there level and value2 is there will
function calcChance(value1, value2) {
if (value1 && value2) {
let result = ((value2 * 0.8) / 2.5) + (value1 / 4)
result = result > 100 ? 100 : result
return result + '%'
}
}
})
also i added checks to make sure not over 100% will deffo play around with yours π