This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Creeper9207's profile picture

Location API (get location of user)

Started by Creeper9207, 15 May 2015 - 09:59 PM
Creeper9207 #1
Posted 15 May 2015 - 11:59 PM
Introducing, the location API!
Simply use to get the User's location (City, State, Country)
Documentation:
SpoilerlocationAPI.getState() –Returns state/region, if there is no specific state/region, it will return Error.noRegion (usually, but not always accurate)
locationAPI.getCity() –Returns city, this is commonly inaccurate, (especially if you are in a rural area)
locationAPI.getCountry() –Returns Country, this should always be accurate

Pastebin:
Spoilerpastebin get t5D6erau locationAPI
Work flow:
SpoilerComputercraft -> CreeperTech.net -> ip-api.com/php/[ip]

Note:
Thanks to ip-api.com for the php service!
Edited on 15 May 2015 - 10:00 PM
Creator #2
Posted 16 May 2015 - 12:17 AM
This is quite clever. It can be used to determine the language an OS should be in, for example.
biggest yikes #3
Posted 16 May 2015 - 12:54 AM
This is quite clever. It can be used to determine the language an OS should be in, for example.
location =/= language
Creeper9207 #4
Posted 16 May 2015 - 01:00 AM
Thanks, other examples might include weather.. etc, also, i will add more functions par request :)/>
Creeper9207 #5
Posted 16 May 2015 - 01:05 AM
if you dont wanna use the api just http request to:
http://creepertech.net/SysX7/location.php?get=state
http://creepertech.net/SysX7/location.php?get=country
http://creepertech.net/SysX7/location.php?get=city
Creator #6
Posted 16 May 2015 - 01:23 AM
Well, technically it is not the same, but let's say there is a certain correlation. It's better than setting it to english automatically. If you can translate it
Creeper9207 #7
Posted 16 May 2015 - 05:13 AM
You know what this would really be good for? Automatically telling the time
Creator #8
Posted 16 May 2015 - 07:51 AM
Yes, it would.
biggest yikes #9
Posted 16 May 2015 - 02:38 PM
Well, technically it is not the same, but let's say there is a certain correlation. It's better than setting it to english automatically. If you can translate it
some countries have more than one language, for example in Belgium they speak French, Dutch, and German.
If you use this method to determine language, how do you know which one to use for people in Belgium?
It seems like the best way is to ask for language on setup.
Edited on 16 May 2015 - 12:57 PM
Creeper9207 #10
Posted 16 May 2015 - 05:30 PM
maybey a prompt to ask if thats thier correct language?
biggest yikes #11
Posted 02 June 2015 - 10:52 PM
maybey a prompt to ask if thats thier correct language?
Well, in that case you'd have to display it in that language, and if they don't understand it it'd be totally worthless. Plus, how would you interpret the language if they're in a country with multiple languages?
Edited on 02 June 2015 - 08:53 PM