+jonny65 Posted October 23, 2013 Share Posted October 23, 2013 For lua freaks ... how to realize this ... : The player stays at a certain point and a small invisible zone is active. Now I want to know the bearing to these zone (or better a point ?) and the distance (for example 117°, 376 ft). Anyone who has a small function for this ? Quote Link to comment
Ranger Fox Posted October 24, 2013 Share Posted October 24, 2013 Please see my Battleship cartridge for many utility functions you can copy and paste into your own cartridge. 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 This function will tell you the distance a player is from a certain zone. If you'd like to know the distance and bearing from any point, just put those to points as arguments to VectorToPoint. The first return value is a distance object (feed it a string representing units, such as "m") and the second is the bearing from the first point to the second. Anyway, perhaps, as a community, we should come out with an entire library of helpful functions like this. Several are in Battleship; we can always add to them. Quote Link to comment
+jonny65 Posted October 24, 2013 Author Share Posted October 24, 2013 Ups, thats all ? Soooo simple ? The bearing is within "Wherigo.VectorToPoint" as a second argument turned back...ah...ok, thanks Ranger Fox. I appreciate, if, as you say, a library would come out, which includes not only the functions, but the usage with the builder. I think most of the Wherigo programmers don't know how to handle a complex function in the builder, call it, define unique (!) identifieres, read out the values and so on. For example in that case, I placed the function in the section "lua user functions" in urwigo, define an interval timer and call the function from the elapse event of the timer. So everybody reproduce (see the snap) how it works together (urwigo and user function). In my beginning I not even know, where to write the lua function down. Perhaps in a message box ? Quote Link to comment
Ranger Fox Posted October 24, 2013 Share Posted October 24, 2013 With regards to Urwigo, it might be good to have a clickable library listing a'la NuGet in Visual Studio. In other words, authors could pop up a box and look through a listing of available library functions and select which ones they want to include within their cartridge. Urwigo could handle function call relationship dependencies. After that, you could make the function call anywhere within the cartridge designer as if it was a normal part of Wherigo. There are so many things to work on before Wherigo is usable for the masses... Quote Link to comment
Tyreless Posted October 24, 2013 Share Posted October 24, 2013 Thanks johnny65 for the example of how to do this in urwigo. Quote Link to comment
+jonny65 Posted October 25, 2013 Author Share Posted October 25, 2013 The attached file has gone ... already again. I guess an important thing, the identifier of the zone must be set, otherwise the cartridge crashes Ranger : I would say it's better that Wherigo generally is too complex for the masses. It persists as an especially type of cache. Quote Link to comment
Ranger Fox Posted October 25, 2013 Share Posted October 25, 2013 Ranger : I would say it's better that Wherigo generally is too complex for the masses. It persists as an especially type of cache. Pardon? That second sentence didn't quite make sense. Quote Link to comment
+jonny65 Posted October 25, 2013 Author Share Posted October 25, 2013 It is a special type of cache. Building a Wherigo is not so easy as another type. It remains rarely. Better that way, instead of more wherigos than traditionals one day. 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.