#1 2019-04-28 03:19:00

showerhead
Member
Registered: 2019-04-28
Posts: 1

Some API Questions

I have developed an alt1 app I think would help a lot of people and would like to eventually release (currently testing and polishing). To that end, I was hoping I could get a little help with some questions about the API.

The first, and hopefully easiest, is the location of the current user's name. I looked through the API, and except for some references to the hiscore mechanic, and another about stat lookup, I can't seem to find it. Right now I have an input for the name, which works alright, but isn't very user friendly. I'm thinking this may not be available (maybe for security reasons?), but figured I'd ask.

Next, the example appconfig has references to requestHandlers, activators, and permissions. However, except for what is in that example file, I cannot find a list of available hooks. My app centers around quests, so being able to press alt1 while hovering a quest would be beneficial, but I am not sure how to go about it. Should I add every quest name to the activators list? Is there an event hook that tells me which activator opened the app?

Last question is about the API itself. Right now I have the alt1lib saved in a local repository and am linking to it directly. Is it also available by default, like a1lib? What is the difference between the two? I noticed at least one redundant function, is one of these deprecated version of the other?

Offline

#2 2019-04-28 07:05:57

Skillbert
Administrator
Registered: 2014-12-30
Posts: 1,057

Re: Some API Questions

I haven't actually coded a player name reader yet but the chatbox reader gets very close. After the find call you'll have the bottom bound and either the exact left bound or an estimate depending on whether the top bar of the chat is minimized. With the positions you can use a similar OCR call as the chatbox reader does to read the name. You'll have to be careful with titles tho.


Request handlers are a deprecated concept. You can get similar behavior with app activator phrases. These support regex if prefixed with "regex:", so you can go crazy. If the app wasn't open before getting activated, you can find the regex match in alt1.openInfo. If the app was open already you'll get an event to alt1.events.alt1pressed. The activators are reloaded from the config every time you load the app so you can change them but they might become stale.

Are you talking about the npm package? The npm packages (and github) are meant to completely supersede the libs found on the website. They are still very much work in progress so the old libs aren't obsoleted just yet. I would recommend using the old libs for now if you don't have experience with the typescipt/webpack/etc workflow.

Offline

#3 2019-04-28 07:06:24

Skillbert
Administrator
Registered: 2014-12-30
Posts: 1,057

Re: Some API Questions

Also, come join the discord https://discord.gg/G3SbcS8

Offline

Board footer

Powered by FluxBB