Jump to content

Documentation could be a bit better


fixthissite

Recommended Posts

I've seen waaaay worse when it comes to documentation, so I'm not saying it could be better based on comparisons.

 

Since I can't run scripts and test functions (no old school RuneScape account), I'm attempting to write scripts using what I can scrape from the documentations. I have quite a few questions about some functions that can really only be answered through testing or documentation, for example:

 

Bank#open() - "Searches for the best bank, based on type and distance of player"

 

I'm assuming this searches for a bank within view. Of course, this is just an educated guess; I would have to test it to make sure. Maybe have something like  "Searches for the best bank within sight, based on type and distance of player. Does nothing if no banks are in sight."

 

Bank#getItems() - "Gets the array of items stored in this container"

 

What's the container? The bank or a tab? If I call this method without the bank being open, what will happen?

 

______________________________________________________

 

It'll help out quite a bit, seeing how there's no test server. I'm sure it's the last thing you guys are worried about, but it's something that could definitely be improved. Thanks for taking the time to read this smile.png

Edited by fixthissite
Link to comment
Share on other sites

I've seen waaaay worse when it comes to documentation, so I'm not saying it could be better based on comparisons.

 

Since I can't run scripts and test functions (no old school RuneScape account), I'm attempting to write scripts using what I can scrape from the documentations. I have quite a few questions about some functions that can really only be answered through testing or documentation, for example:

 

Bank#open() - "Searches for the best bank, based on type and distance of player"

 

I'm assuming this searches for a bank within view. Of course, this is just an educated guess; I would have to test it to make sure. Maybe have something like  "Searches for the best bank within sight, based on type and distance of player. Does nothing if no banks are in sight."

 

Bank#getItems() - "Gets the array of items stored in this container"

 

What's the container? The bank or a tab? If I call this method without the bank being open, what will happen?

 

______________________________________________________

 

It'll help out quite a bit, seeing how there's no test server. I'm sure it's the last thing you guys are worried about, but it's something that could definitely be improved. Thanks for taking the time to read this smile.png

bank#open looks for the closest bank booth. doesnt support npc bankers not sure about chest. Also it doesnt matter if it in sight i believe it will walk to entity and also rotate camera to the bank.

 

Bank class extend item container. if bank isnt open then you simply get a null 

 

ps. the bank itself is a item container just like a shop and also inventory.

Edited by josedpay
  • Like 1
Link to comment
Share on other sites

if bank isnt open then you simply get a null 

It should mention that in the document's return clause /: And thanks for the information, especially about the bank booths! But I have a lot of questions.. Asking them all in a single thread would be overwhelming, and creating a bunch of new threads would clutter up the question area. I was just hoping someone, on their free time, might be able to polish up the documentation a bit

Link to comment
Share on other sites

It should mention that in the document's return clause /: And thanks for the information, especially about the bank booths! But I have a lot of questions.. Asking them all in a single thread would be overwhelming, and creating a bunch of new threads would clutter up the question area. I was just hoping someone, on their free time, might be able to polish up the documentation a bit

 

 

Why should it mention that? If you ever try to get an object, interface, npc, or anything else, assume that if its not there it will return null. That is the only logical thing for a method to return when it is supposed to return an object and it fails. 

  • Like 1
Link to comment
Share on other sites

Why should it mention that?

Well it's convention (similar to good identifier names). APIs should never force the client to assume things about it. Any well written documentation states these specifications. "returns null otherwise" or SOMETHING would be useful. It could return an empty array (which is actually recommended) for all I know

Link to comment
Share on other sites

Well it's convention (similar to good identifier names). APIs should never force the client to assume things about it. Any well written documentation states these specifications. "returns null otherwise" or SOMETHING would be useful. It could return an empty array (which is actually recommended) for all I know

 

 

Fair enough. Im not disagreeing with you necessarily I am just saying it is a safe assumption if you are familiar with the api here. 

Where I work I write alot of code documentation, and I will always specify something like you stated, "otherwise returns null".

For the scope of OSBot, its pretty safe to assume that it will be null though. ^_^

  • Like 3
Link to comment
Share on other sites

Fair enough. Im not disagreeing with you necessarily I am just saying it is a safe assumption if you are familiar with the api here. 

Where I work I write alot of code documentation, and I will always specify something like you stated, "otherwise returns null".

For the scope of OSBot, its pretty safe to assume that it will be null though. happy.png

That's the problem; I'm not familiar, which is why I asked for this. It would help out new people quite a bit as well, since they can quickly view the API and get an idea of what they're going to do.

 

I'll keep that assumpsion for now on; thanks for the heads up

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...