Calculating the distance between 2 blocks (X and Z only)

This might be helpful with someone who is trying to make a module that can calculate how far the player has moved from his starting point.
function diff (a, b) { if (a > b) return a  b else return b  a } var startX = 0, startZ = 0, diffX = 0, diffZ = 0, bruh = 0; module.on("enable", function() { startX = mc.thePlayer.posX startZ = mc.thePlayer.posZ }) module.on("update", function() { diffX = diff(startX, mc.thePlayer.posX) diffZ = diff(startZ, mc.thePlayer.posZ) bruh = diffX + diffZ Chat.log('Blocks traveled: ' + bruh.toFixed(1).toString()) })

@notautismatall Nice

@notautismatall Math.abs(start  current)
or alternatively, have you ever heard of... the pythagorean distance