Is it possible to know when someone hops online
-
- Ixw [3143585]
- Role: Civilian
- Level: 19
- Posts: 33
- Karma: 3
- Last Action: 4 months
Posted on 14:30:33 - 06/02/24 (7 months ago)Post link copied to clipboard Copy post linkIs the list using territory wars and raid as well? Haven't comved thru the list extensively but I have used it for updating caches for a map of names of people and factions -
Posted on 14:36:37 - 06/02/24 (7 months ago)Post link copied to clipboard Copy post linkWhat do you mean? I went through all possible faction IDs and check up to 100 new IDs on each update to include any factions that have been created since the last update. The IDs are sequential, so it's easy to gather them all, just takes time and API keys.
-
-
- Ixw [3143585]
- Role: Civilian
- Level: 19
- Posts: 33
- Karma: 3
- Last Action: 4 months
Posted on 20:58:56 - 06/02/24 (7 months ago)Post link copied to clipboard Copy post linkAhhh okay sweet so then my check for something is pointless lol, that is great so my initialization based off active factions should be all factions I think is there like a runtime error you get from the API if you go over 100 calls a minute or the daily number of calls? That will be fun to randomly run into later lol -
Posted on 21:04:15 - 06/02/24 (7 months ago)Post link copied to clipboard Copy post linkThere are several limits, most ties to api key owner. If you want to grab all factions, you might not be able to do it with a single key. My list includes all non-dead factions, you can filter them for activity, member count, rank etc. to trim that list even more.
-
-
- Ixw [3143585]
- Role: Civilian
- Level: 19
- Posts: 33
- Karma: 3
- Last Action: 4 months
Posted on 14:04:13 - 10/02/24 (7 months ago)Post link copied to clipboard Copy post linkdoes the api return something not equal to 200 when getting an error, because i occasionally have it return with a 200 status code but it still has an error in the json()[key] -
Posted on 14:34:28 - 10/02/24 (7 months ago)Post link copied to clipboard Copy post linkTorn itself does not use HTTP status codes as part of the response. You might sometimes get something else like an HTTP 502, but then it's a CloudFlare response and not from Torn.
-
-
- Ixw [3143585]
- Role: Civilian
- Level: 19
- Posts: 33
- Karma: 3
- Last Action: 4 months
Posted on 17:07:21 - 10/02/24 (7 months ago)Post link copied to clipboard Copy post linkhmmmm the most annoying part is that when the error happens it is v inconsistent so fixing it is rough, i guess ill add debug code for outputting values for when the error happens -
-
-
- Ixw [3143585]
- Role: Civilian
- Level: 19
- Posts: 33
- Karma: 3
- Last Action: 4 months
Posted on 15:38:21 - 11/02/24 (7 months ago)Post link copied to clipboard Copy post linkmy saying it is inconsistent means that it rarely happens and the error is sort of vague when the error happens it is at the json decode level but for now its not a major issue but replicating the error is out of my hands sadly so im not sure exactly with the site returns -
Posted on 08:16:48 - 29/02/24 (7 months ago)Post link copied to clipboard Copy post linkI know this is ages ago now, but just for your own knowledge... there is actually nothing wrong per say with a nested loop as long as it is performant. Don't fall into the hole of "this is bad sometimes, so I should never use it". For a small script/application like a Discord Bot or something, as long as you're not querying a huge endpoint, the time performance of most functions/patterns isn't a huge issue.
If there is a better way you can think of, then sure do it that way. But otherwise, don't let it block you actually making something. Can always be replaced later if your knowledge improves/you find a better way.
That said, I wouldn't probably go deeper than one level with it, but you can also deserialize most of the API calls to a Map/Dict structure (depending on language) which can speed up processing in many situations too by allowing a key-value lookup instead of iterating across a list.Last edited by Nexus on 08:18:15 - 29/02/24[img]https://i.ibb.co/vh8Bcmr/image.png[/img]
-