Jump to content

Measuring Distance Walked


The Cartooners

Recommended Posts

AFAIK the cartridge asked you to walk so many metres away from your current location. That's easily done by saying you're at the centre of a zone of that radius and getting you to exit the zone. But I don't think you can count how many metres across the ground the player has walked, in the way that the GPSr does.

 

If you want to see how long they took, start an interval (as opposed to countdown) timer, have it increment a variable each time it ticks, and see how far it's got by the time the player exits the zone.

 

(I suspect you could probably have worked that out by yourself. :))

 

It would be nice if the runtime systemPlayer could expose some of the GPSr's features via an API. Then you could save the value of "GPRs.totalDistanceTravelled" at the start of a routine and subtract that from the current value at any point, to determine how far the player had walked.

Edited by sTeamTraen
Link to comment

I'll have to look in my Whack-A-Lackey cartridge if you want code snippets (it's open source, so you could look as well). Here's how to do it:

 

Save the player's current position as a ZonePoint.

Start an interval timer.

On each tick, measure the distance between the user's current position and the ZonePoint you saved.

 

--This returns the distance object and bearing between two points, namely the current location and the starting point.
local d2,b2 = Wherigo.VectorToPoint(Player.ObjectLocation, myStartingZonePoint)

--This will give you the distance in feet.
d = d2("ft")

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...