OoP's Odd Bot Functions

Potatoman

New member
OoP's Odd Bot Functions​
The story thus far:
In the process of writing up a bot for my clan, I ended up creating a library of functions to be called up in my main script. They're not the most stunning under the sun, but they work well, and stably for their (myriad) intended tasks. After writing them up, I thought others might like some of them too, so I thought I'd upload it here. (Too large a collection to put in-message :p)


Available Functions:

boolean change_tattoo( string tattoo_name )
Changes your tattoo to the provided tattoo name (as can found on the wiki, or account_tattoos.php). Returns a boolean of the operation's success.

boolean random_tattoo()
Changes your tattoo to a randomly-selected tattoo you have unlocked. Returns a boolean of its success.

int[string] clan_war_status()
Returns a map of your clan's current Clan Warfare 'items', and if you can attack. (More details can be found in the script)

boolean attack_clan( int clan_number )
Attacks the clan of the provided Clan ID#, returning a boolean of the attack's success. (As in, whether you attacked or not.)

boolean change_custom_title( string custom_title )
Changes your player's selected custom title to one containing the provided string custom_title, and returns a boolean of its success. Useful for showing a bot's current state (if you/your patron is wealthy). Inputting "normal" will revert back to KoL's default class titles.

boolean write_profile( string quote )
boolean write_profile( boolean quote_only, int age, int gender, string location, string website, string profile_text )

Modifies your profile, returning a boolean of its success. If you choose to only modify your quote, the rest of your profile will remain unchanged.

boolean write_display_case( string dc_text )
Changes your display case's text, returning a boolean of its success.

boolean buy_clan_training( int quality , string training_type )
Purchases the selected clan training, and returns a boolean of its success. Quality can be from 1 to 3; Valid training_type values are: "muscle", "myst", "moxie", "muscle buff", "myst buff", "moxie buff", "items", "meat", and "adventure".


------------------Below this line there be (possibly) unnecessary, but working (and nice) functions------------------


record[int] stash_logger()
Returns a record of the clan stash log, containing the elements: datestamp, timestamp, playername, playerid, action, amount, changeditem. So that it can enjoy the use of the new Sort function.

boolean donate_clan_stash( int amount )
Donates the provided amount of meat to the clan stash, and returns a boolean of the operation's success.

int[item] stash_retrieve()

Returns the contents of the Clan Stash as a map of items (and the number in the stash).

boolean add_stash_items( int[item] additions )
Adds all the items in the provided map (in their quantities) to the Clan Stash. Returns a boolean of its success.

boolean remove_stash_items( int[item] removal )
Removes the items of the provided map (in their respective quantities) from the clan stash, (making use of the kolmafia command and recursion) and returns a boolean of the operation's success.

string password_grab()
Returns the pwd value of your current session. (Pulled from toppane.php). Not used in-script any more, just as a backup/double-check.

Hope these are of help to some of you guys. :)
 

Attachments

  • OddBotLib.ash
    16.4 KB · Views: 30
Last edited:

Potatoman

New member
I may use the tattoo functions. Some of the clan functions look nice too.

Aww, thanks! :)

In other news, I re-formatted it for easier reading. Oh, and Notepad++ totally kicks Notepad's ass. Uploaded the revamped version. :)

Particularly proud of the custom title function, I have to say. I love it. :)
 
Top