usage examples for HelperFunctions.kt
This commit is contained in:
parent
f0fd48094e
commit
74d17b76ef
@ -2,6 +2,7 @@ import java.awt.Point
|
|||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
// Routines.fullRunIncense(0, 0, 0, 257)
|
// Routines.fullRunIncense(0, 0, 0, 257)
|
||||||
Routines.processInventoryAtFurnace(3566)
|
// Routines.processInventoryAtFurnace(3566)
|
||||||
|
println(HelperFunctions.prettyTimeString(72134))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,17 @@ object HelperFunctions {
|
|||||||
/**
|
/**
|
||||||
* Computes the total number of steps needed to process the given total volume.
|
* Computes the total number of steps needed to process the given total volume.
|
||||||
*
|
*
|
||||||
|
* This takes the total volume that needs to be processed and th
|
||||||
|
* and calculates the total steps required.
|
||||||
|
* Usage examples:
|
||||||
|
* ```
|
||||||
|
* val total = 550
|
||||||
|
* val perStep = 200
|
||||||
|
* val steps = calculateTotalSteps(total, perStep) // 3 steps
|
||||||
|
*
|
||||||
|
* val steps = calculateTotalSteps(1000, 100) // 10 steps
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param totalVolume the total amount that needs to be processed
|
* @param totalVolume the total amount that needs to be processed
|
||||||
* @param volumePerStep the amount to process per step
|
* @param volumePerStep the amount to process per step
|
||||||
* @return the number of steps required to process the total volume
|
* @return the number of steps required to process the total volume
|
||||||
@ -20,6 +31,21 @@ object HelperFunctions {
|
|||||||
/**
|
/**
|
||||||
* Prints a progress report to console showing current step, total steps, elapsed time, and estimated remaining time.
|
* Prints a progress report to console showing current step, total steps, elapsed time, and estimated remaining time.
|
||||||
*
|
*
|
||||||
|
* This takes the current step number, total steps, and elapsed duration and prints a progress report.
|
||||||
|
* Typical usage is to call this within a loop, passing the loop index for current step and total loop count.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Usage example:
|
||||||
|
* ```
|
||||||
|
* val totalSteps = 100
|
||||||
|
* val start = System.currentTimeMillis()
|
||||||
|
* for (i in 1..totalSteps) {
|
||||||
|
* // Do work
|
||||||
|
*
|
||||||
|
* report(i, totalSteps, System.currentTimeMillis() - start)
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param step The current step number
|
* @param step The current step number
|
||||||
* @param of The total number of steps
|
* @param of The total number of steps
|
||||||
* @param dur The elapsed duration so far in milliseconds
|
* @param dur The elapsed duration so far in milliseconds
|
||||||
@ -32,6 +58,16 @@ object HelperFunctions {
|
|||||||
/**
|
/**
|
||||||
* Converts a duration in milliseconds to a human-readable string.
|
* Converts a duration in milliseconds to a human-readable string.
|
||||||
*
|
*
|
||||||
|
* This takes a duration in ms and converts it to a formatted string like "2h13m4s".
|
||||||
|
*
|
||||||
|
* Usage example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* val duration = 72134 // ms
|
||||||
|
* val timeStr = prettyTimeString(duration)
|
||||||
|
* // "1m12s"
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @param durationMillis The duration to convert, in milliseconds
|
* @param durationMillis The duration to convert, in milliseconds
|
||||||
* @return A string representation of the duration, in the format XhYmZs
|
* @return A string representation of the duration, in the format XhYmZs
|
||||||
*/
|
*/
|
||||||
@ -62,7 +98,8 @@ object HelperFunctions {
|
|||||||
* variable name, like:
|
* variable name, like:
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* val myPoint = Point(123, 456)
|
* val location = getPointerLocationAsValDeclarationString("clickPoint")
|
||||||
|
* // val clickPoint = Point(123, 456)
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* The delay before getting the pointer location helps ensure the mouse has
|
* The delay before getting the pointer location helps ensure the mouse has
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user