+Landondena Posted July 30, 2012 Share Posted July 30, 2012 I am working on a Wherigo where I want to know the users distance from a location. I don't want the user to know the location but I want to be able to tell them the distance. How can I make this happen? I'm using urwigo been playing around with it for several days. If i'm able to pull the users GPS Coordinates I can calculate the distance behind scenes. Any ideas? Quote Link to comment
+MightyReek Posted July 30, 2012 Share Posted July 30, 2012 I am working on a Wherigo where I want to know the users distance from a location. I don't want the user to know the location but I want to be able to tell them the distance. How can I make this happen? I'm using urwigo been playing around with it for several days. If i'm able to pull the users GPS Coordinates I can calculate the distance behind scenes. Any ideas? You can create zones around the target-location and that way you'll be able to know where he is by the zones he already crossed... Something like this: Quote Link to comment
+cantuland Posted July 30, 2012 Share Posted July 30, 2012 I am working on a Wherigo where I want to know the users distance from a location... This is something that I have inside my Wherigo. I'm not sure how you are to put it inside yours. cartGeocacheotopia.MsgBoxCBFuncs.MsgBoxCB1 = function(action) --Check for GPS signal. If good, move on. --If not, Turtle will say that they need a better signal from the heavens above, so restart the cartridge. uv = Env.DeviceID wx = Player.ObjectLocation.altitude:GetValue(ft) yz = Player.PositionAccuracy:GetValue(ft) if ((Wherigo.NoCaseEquals(uv,"DeskTop")) or (wx < 3) or (yz <= 3) or (yz > 150)) and (testmode < 1) then --if Turtle does not allow Player to go on, then CB10 Wherigo.MessageBox{Text=[[You are looking for GEOCACHEOTOPIA; I know this.]],Media=zmediaturtle,Buttons={"Wow! You're good.",},Callback=cartGeocacheotopia.MsgBoxCBFuncs.MsgBoxCB10} else --else Turtle lets them pass Wherigo.MessageBox{Text=[[You are looking for GEOCACHEOTOPIA; I know this. I think you are finally ready.]],Media=zmediaturtle,Buttons={"Wow! You're good.",},Callback=cartGeocacheotopia.MsgBoxCBFuncs.MsgBoxCB2} end --if end --CB1 cartGeocacheotopia.MsgBoxCBFuncs.MsgBoxCB10 = function(action) --Tell Player to restart and try again. Wherigo.MessageBox{Text=[[unfortunately, your ability to communicate with the GPS heavens above is not quite adequate at the moment. Go get a good signal and restart this Wherigo cartridge. We will continue then.]],Media=zmediaturtle,Buttons={"I'll be back.",},Callback=cartGeocacheotopia.MsgBoxCBFuncs.MsgBoxCB11} end --CB10 Quote Link to comment
Ranger Fox Posted July 31, 2012 Share Posted July 31, 2012 I have several utility functions within my Battleship cartridge, which is easier to read and understand than Whack-A-Lackey. Both cartridges are open source, so feel free to look around. Battleship is well-commented and organized. Here's one of the functions you might find useful: function DistanceFromZone(zone, units) local d2,b2 = Wherigo.VectorToPoint(Player.ObjectLocation, zone.OriginalPoint) local d = d2(units) --print("Distance from zone " .. zone.Name .. " = " .. d) return d end You give it a zone and units (e.g. feet, meters) and it will tell you how far the player is from that zone in those units. Simple, and exactly what you wanted: it'll tell you the player's distance from a certain location. You could also modify it to accept coordinates if you'd like, as both parameters of VectorToPoint are coordinates (note: I have not tested this): function DistanceFromCoords(latitude, longitude, units) local d2,b2 = Wherigo.VectorToPoint(Player.ObjectLocation, Wherigo.ZonePoint(latitude, longitude)) local d = d2(units) --print("Distance from coords " .. zone.Name .. " = " .. d) return d end Quote Link to comment
+Landondena Posted July 31, 2012 Author Share Posted July 31, 2012 Hopefully I can play with this and get someething going. Whats the best way to emulate LUA code carts? Quote Link to comment
Ranger Fox Posted August 1, 2012 Share Posted August 1, 2012 Groundspeak's Wherigo emulator is the only way thus far. It's bundled with both Groundspeak's Wherigo Builder and Urwigo. Quote Link to comment
+Landondena Posted August 3, 2012 Author Share Posted August 3, 2012 I was able to get the distance from a zone to work in Urwigo. It just took some digging and playing. There is a distance to zone command and it particular about the commands and locations you place it in. Quote Link to comment
+surf89 Posted August 27, 2012 Share Posted August 27, 2012 I am trying to get an elevation setting from the gps. Has anyone got an idea on how to do this? I have seen some code but can not get it to play nice with Urwigo builder. Quote Link to comment
Recommended Posts
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.