Starting a library

Gauth

New member
I've found this little beginning of a library to be useful in my various scripting, and I thought others may as well. There's nothing really crazy or advanced, but useful none the less. ;)

Edit:

I have made some updates to my CommonLib.ash script, should anyone want to check it out.

Updates:

  • [li]Cleaned up existing code[/li]
    [li]Added some utility methods, such as max/min[/li]
    [li]Added a couple of additional "wrapper" calls to CLI commands[/li]
    [li]Added a take method that works like get, just w/o buying[/li]
    [li]Added a method to equip familiars with their appropriate items[/li]

Updated attached script
 

Attachments

  • CommonLib.ash
    8.8 KB · Views: 122
I am looking over your library, and have a couple of comments:

First, just as an alternate way of thinking (your way works perfectly fine), you could change take_stash() as such:

When you define success, you could make the line
Code:
boolean success = false;

Then you could get rid of the else portion of the check.

Second, I really, really, really like the idea of wear_outfit(). That was some good thinking. I personally do not do enough outfit swapping to make use of it... But I still enjoy the cleverness behind it.

Next, while I can understand the usefulness of send_multi(), I would suggest using it sparingly. Don't wanna attract to much attention to yourself, and all. ;)

Get() is really clever to. I like what you are doing there. At the moment, I can not think of any better way to write it... But there is an itch in my brain that says the writting could be cleaner... This is probably a false itch. Every time I get it for one of my scripts, the writting ends up being longer - and probably less efficient. But it looks cleaner! :p
 

Sako

Member
Same here... I'm definitely gonna use some of this stuff. Good work~

Off topic: hasn't anybody noticed the typo in the title of this board?
 

Gauth

New member
[quote author=Presto Ragu link=topic=173.msg860#msg860 date=1148128722]
I am looking over your library, and have a couple of comments:

First, just as an alternate way of thinking (your way works perfectly fine), you could change take_stash() as such:

When you define success, you could make the line
Code:
boolean success = false;

Then you could get rid of the else portion of the check.

Second, I really, really, really like the idea of wear_outfit(). That was some good thinking. I personally do not do enough outfit swapping to make use of it... But I still enjoy the cleverness behind it.

Next, while I can understand the usefulness of send_multi(), I would suggest using it sparingly. Don't wanna attract to much attention to yourself, and all. ;)

Get() is really clever to. I like what you are doing there. At the moment, I can not think of any better way to write it... But there is an itch in my brain that says the writting could be cleaner... This is probably a false itch. Every time I get it for one of my scripts, the writting ends up being longer - and probably less efficient. But it looks cleaner! :p
[/quote]

You know, I was going to yank both send and send_multi, since I don't use either, and didn't want to enable some easier multi-abuse. After trying them out, I realized that KoLmafia sends a specific message in the body, so it would be pretty easy for the KoL folks to see who is using this in ways they do not appreciate. I would highly suggest using it sparingly as well.

I got the idea for the get method, based on the built in retrieve (I think that's the one) method. I just wanted a specific order in which each possible source was checked.

This is really my first stab into the ASH scripting, so I'm sure you'll notice some things that could be done better and/or cleaner. Actually, that's one of the reasons why I posted it: In the hopes that I could get some critiques on improving things. The other reason was just to give some inspiration for others to try some things out.

Thank you for all the helpful comments and critiques. I honestly do appreciate your feedback.
 
Top