API and Hooks
Wiki updated as of 5.4.1 (Nov 2026)Accessing the API
Section titled “Accessing the API”Use game.modules.get('travel-pace').api, or the global TRAVELPACE object.
Members
Section titled “Members”| Member | Description |
|---|---|
unit | Property. The world’s distance unit abbreviation. |
calculateTravel(data) | Calculate a journey without posting anything. |
submitCalculation(data) | Calculate a journey and post it to chat, firing travelPace.calculated. |
createChatMessage(result) | Post an already-calculated result to chat. |
durationToSeconds(totalMinutes, dayHours) | Convert travel minutes to world-time seconds, following the Day Advance Mode setting. Pass a result’s speed.hours as dayHours to use the traveller’s travel day. |
openCalculator() | Open the calculator, or bring the open one forward. |
The input payload
Section titled “The input payload”calculateTravel and submitCalculation take:
| Property | Description |
|---|---|
mode | 'distance' or 'time'. |
pace | A CONFIG.DND5E.travelPace id, such as 'slow', 'normal', or 'fast'. |
travelType | Optional. A CONFIG.DND5E.travelTypes id: 'land', 'water', or 'air'. Defaults to the traveller’s fastest. |
distance | Distance in the world’s travel unit. Required in distance mode. |
time | An object with days, hours, and minutes. Days are travel days. Required in time mode. |
mount | A creature, vehicle, or group actor to travel as, or null to travel on foot. |
The result
Section titled “The result”A result carries the mode it ran in, the original input with the pace actually travelled at, the output (totalMinutes plus either time/timeFormatted or distance), the pace’s mechanical-effect text, paceSlowed when a slowed member held a party to Slow pace, the traveller’s resolved speed, the list of applied modifiers, their combined multiplier, and the traveller’s UUID when one was used. The speed includes its travel type, hours per travel day, and paced, which is false when pace does not change it. The effect text is empty when pace does not apply.
travelPace.preCalculate
Section titled “travelPace.preCalculate”Fires before every calculation, including each live update in the calculator window. Return false from a listener to cancel, and the API call returns null.
Receives an object with data, the input payload, and modifiers, a mutable array of {id, label, multiplier} entries that already holds any active weather modifiers. Push onto modifiers to apply your own multiplier. Each modifier gets its own line on the chat card.
travelPace.calculated
Section titled “travelPace.calculated”Fires after submitCalculation posts a chat message, including from the calculator’s Send to Chat button. Receives the result and the created ChatMessage.