Difference between revisions of "Gps (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Family Movie - Find the Right DVD Movie Club For Your Family)
m (Changed "axises" to "axes", changed formatting)
 
(26 intermediate revisions by 18 users not shown)
Line 1: Line 1:
Looking for a good online family movie team or family movie review?
+
The GPS API provides a method for turtles and computers to retrieve their own locations.
+
 
Family movies sell lots of tickets at the box office and annually there are a single or far more blockbuster movies that are family motion pictures.  
+
It broadcasts a PING message over [[Rednet_(API)|rednet]] and wait for responses. In order for this system to work, there must be at least 4 computers used as gps ''hosts'' which will respond and allow [[Wikipedia:Trilateration|trilateration]]. Three of these hosts should be in a plane, and the fourth should be either above or below the other three. The three in a plane should not be in a line with each other. You can set up hosts using the [[Gps (program)|gps program]].
+
 
But with the high price of movie tickets and theatre concessions, watching movies on DVD because a family group movie night in the comfort of the individual property, is truly quickly becoming very popular.  
+
Note:  When entering in the coordinates for the ''host'' you need to put in the x, y, and z coordinates of the '''computer''', not the modem, as all rednet distances are measured from the block the computer is in.  
+
 
Online DVD Movie Golf equipment
+
Also note that you may ''choose'' which axes x, y, or z refers to - so long as your systems have the same definition as any GPS servers that're in range, it works just the same. For example, you might build a GPS cluster according to [http://www.computercraft.info/forums2/index.php?/topic/3088-how-to-guide-gps-global-position-system/ this tutorial], using z to account for height, or you might use y to account for height in the way that Minecraft's debug screen displays.
+
 
Online there are a number of DVD movie golf equipment that include family movies within their rental libraries, but only a handful of actually specialize in providing leading family fare.
+
<!-- do not edit this without actually testing it yourself -->
+
 
While other companies produce some family pictures, none provides come close to the huge library of movies that Disney has offered us.
+
{{API table|Gps|image=Grid_disk.png|2=
+
 
Walt Disney brought us Steamboat Willie in 1928 starring Mickey Mouse and in 1973, the Disney Studios gave us Snow Whitened, the first feature length animated movie.  
+
{{API table/row|gps.locate(<nowiki>[</nowiki>{{type|number}} timeout [, {{Type|boolean}} debug]])|({{Type|number}} x, {{Type|number}} y, {{Type|number}} z) or {{Type|nil}}|Tries to retrieve the computer or turtles own location. On success, returns the location of the turtle’s modem. On failure (if no responses are received for <var>timeout</var> seconds, by default 2), returns {{Type|nil}}. If <var>debug</var> is <code>true</code>, debug messages are printed.|odd}}
+
 
Disney Movie Golf club
+
}}
+
 
Online the Disney Movie Golf club presents their signature classic movies, recent releases, preschool dvds, sing-a-prolonged video and other popular family choices.
+
== Example ==
+
  print("Man I am so lost right now!")
Movie Golf equipment
+
  local x, y, z = gps.locate(5)
+
  if not x then --If gps.locate didn't work, it won't return anything. So check to see if it did.
Other online family movie night clubs include Family Pass (formerly known since Mentura) which bills itself while "your priced to family entertainment." Family Pass carries a wide selection of movies, television plans, educational and place school vids and spiritual fare. Most targeted at a family group audience.
+
    print("Failed to get my location!")
+
  else
Edited Movies
+
    print("I am at (" .. x .. ", " .. y .. ", " .. z .. ")") --This prints 'I am at (1, 2, 3)' or whatever your coordinates are
+
  end
Another popular source of movies well suited for family viewing comes through companies that specialize in editing movies to get rid of profanity, excessive violence and a lot more adult situations.
+
 
+
== Vector Example ==
Club users can rent the edited, version of popular movies desires to otherwise become far less than family friendly.  
+
GPS position and navigation can be handled more easily using a [[vector (API)|vector]].
+
 
Online night clubs that edit movies include CleanFilms, Flick'utes Membership, Family Edited DVDs and CleanFlix to name a number of.  
+
  local home = vector.new(45, 85, 20)
+
  local position = vector.new(gps.locate(5))
DVD Software Filters
+
  local displacement = position - home
+
 
An enterprise called ClearPlay presents DVD software package that removes graphic violence, profanity and a lot more adult situations. Movie filters are build for particular movies and ClearPlay's list is maintained to grow.  
+
  print("I am ", tostring(displacement), " away from home!!!")
+
 
Family Movie Reviews
+
[[Category:APIs]]
+
Online can be another great place to discover family movie review sites which help parents when considering to deciding which movies to find out in theatres or on DVD.
+
+
The Dove Foundation, lengthy a family group movie advocate, provides online movie and movie reviews. And if you're out shopping for movies or video tutorials at your favorite store, you can search for the Dove Foundation'utes Seal of Approval (much like the "Good Housekeeping Seal of Approval"). The Dove Foundation'ersus seal is only awarded to movies and video tutorials that meet certain family viewing standards and have been screened and evaluated by Dove Foundation reviewers.  
+
+
Other movie reviews available online include The Family Style Movie Guide, Movie Mom, Screen It!, Family Cow, Grading the Movies, Kids-In-Mind, and Ted Baehr'ersus MovieGuide which examines and rates movies through a Christian value stay point.
+
+
Family Movie Night
+
+
Watching movies at place on DVD because a special night for the complete family offers grow to be very popular.  
+
+
Exactly why use a simple fortune consuming your family to see a movie at a theatre when you can have leading fun time in the personal place? With a special movie night you control the movies your family views. No more unpleasant surprises! And you're full the supreme seat in the house.  
+
+
DVD Movie Membership
+
+
It'utes easy to join a helpful online movie club that gives movies for the family or better yet "specializes" in family movies and video recording.
+
+
So possess a look at what's on the internet and join a family group movie golf club. Most offer a variety of special benefits to membership users that make online membership a regular membership very convenient and affordable.
+
+
Then pick upward some fabulous popcorn and some other treats and start the wonderful tradition of family movie night on your property, a tradition you and your kids will fondly remember for quite a few years to come.
+
+
And remember, some of the best and most favored movies of almost all time have been family movies.
+

Latest revision as of 12:07, 14 August 2015

The GPS API provides a method for turtles and computers to retrieve their own locations.

It broadcasts a PING message over rednet and wait for responses. In order for this system to work, there must be at least 4 computers used as gps hosts which will respond and allow trilateration. Three of these hosts should be in a plane, and the fourth should be either above or below the other three. The three in a plane should not be in a line with each other. You can set up hosts using the gps program.

Note: When entering in the coordinates for the host you need to put in the x, y, and z coordinates of the computer, not the modem, as all rednet distances are measured from the block the computer is in.

Also note that you may choose which axes x, y, or z refers to - so long as your systems have the same definition as any GPS servers that're in range, it works just the same. For example, you might build a GPS cluster according to this tutorial, using z to account for height, or you might use y to account for height in the way that Minecraft's debug screen displays.


Grid disk.png  Gps (API)
Function Return values Description
gps.locate([number timeout [, boolean debug]]) (number x, number y, number z) or nil Tries to retrieve the computer or turtles own location. On success, returns the location of the turtle’s modem. On failure (if no responses are received for timeout seconds, by default 2), returns nil. If debug is true, debug messages are printed.

Example

 print("Man I am so lost right now!")
 local x, y, z = gps.locate(5)
 if not x then --If gps.locate didn't work, it won't return anything. So check to see if it did.
   print("Failed to get my location!")
 else
   print("I am at (" .. x .. ", " .. y .. ", " .. z .. ")") --This prints 'I am at (1, 2, 3)' or whatever your coordinates are
 end

Vector Example

GPS position and navigation can be handled more easily using a vector.

 local home = vector.new(45, 85, 20)
 local position = vector.new(gps.locate(5))
 local displacement = position - home
 
 print("I am ", tostring(displacement), " away from home!!!")