Looking for help making a script for wadbotting castle items.

Bale

Minion
What would be the maximize command for meat farming?

That depends on where you're farming meat and how. If you are only interested in maximizing meat drops you'd use maximize meat drop , however if you wanted 50% to both item and meat drops, then you might use maximize 0.5 item drop, 0.5 meat drop . The numbers indicate how much weight you want to give to each factor, so if you wanted 25% weight to item drop and 75% to meat drop bonuses, you'd do it like this: maximize 0.25 item drop, 0.75 meat drop . It's almost always nice to have at least a little item drop bonus, so I suspect the last one is what you'd prefer.
 
Last edited:

slyz

Developer
Code:
  if (item_amount($item[paperclip pants]) == 0)
	buy( 25 , $item[paperclip]);
	use( 25 , $item[paperclip]);
Maybe you hadn't realized that the above is the same as:
Code:
if (item_amount($item[paperclip pants]) == 0)
{
	buy( 25 , $item[paperclip]);
}

use( 25 , $item[paperclip]);
I think you wanted to do:
Code:
if (item_amount($item[paperclip pants]) == 0)
{
	buy( 25 , $item[paperclip]);
	use( 25 , $item[paperclip]);
}

I want to add the ability to buy/equip the Club Jacket ONLY IF the character has Torso Awaregness. How would i go about doing so?
You have to use the have_skill() function:
PHP:
if ( have_skill( $skill[ Torso Awaregness ] ) )
{
	if ( available_amount( $item[ General Sage Lonely Diamonds Club Jacket ] ) == 0 )
	{
		buy( 1, $item[ General Sage Lonely Diamonds Club Jacket ] );
	}
	equip( $item[ General Sage Lonely Diamonds Club Jacket ] );
}
 

monster hunter

New member
Thanks a lot, slyz. I'll be sure to add the part for the shirt. I have a question. What's the advantage of using the {} symbols if the script works?

Okay, so how would i have mafia check for the wads? Bale, you said its complex, but I'm willing to learn. I've picked up quickly, and feel ready for the challenge.
 
Last edited:

Bale

Minion
Thanks a lot, slyz. I'll be sure to add the part for the shirt. I have a question. What's the advantage of using the {} symbols if the script works?

The brackets cause several statements to all be executed as a result of a single conditional or loop. Otherwise they are sometimes used for clarity. Clarity is good.


Okay, so how would i have mafia check for the wads? Bale, you said its complex, but I'm willing to learn. I've picked up quickly, and feel ready for the challenge.

I'm not exactly sure. You'd need to intercept the chat alert that you have received a message from wadbot and then refresh inventory when it appears. I believe that would require a chatbotScript. You could probably enable the chatbotScript with a set_property("chatbotScript", "scriptname.ash") and then after the message appears disable it accordingly and refresh inventory so that mafia recognizes the newly arrived wads, but that's as far as my suppositions go since I've never made a chatbotScript.

Someone else might be able to flesh that out with more details.
 

heeheehee

Developer
Staff member
That thread... is from five years ago. I presume the purpose of the banned scripts list was to enforce some sense of ethics and not provide an unfair advantage (e.g. writing a mallbot, for instance) or ruin the game experience (in fact, that's why for the longest time new content wasn't supported until a month after release). I'm not totally sure, since said list is no longer around, and few of the participants from that conversation are still around (just hola, I think?).
 

Veracity

Developer
Staff member
The game & KoLmafia has moved on from five years ago. Back then, hola was vehemently opposed to any ascension script - for the reasons he listed in the 5-year old thread you quoted: the "purpose" of KoLmafia is to help you "interact with the game" rather than to let you avoid interacting with the game.

The five-year-old thread you quoted is completely irrelevant. I can't imagine how you managed to stumble on it. And, no - I will not try to "explain the general stigma against bounty-hunting" since I was never - even 5 years ago - aware of any such "general stigma".

But, even 5 years ago, hola and I did not share a brain, and therefore did not necessarily see things the same way. :)
 

monster hunter

New member
Ah, I see. The problem with "interacting with the game" is that it gets very redundant very fast. I've been on hiatus for a long time, and so there's lots of new content. But then again, farming hasn't changed much (if not at all). I've done so many of the different bounty hunting quests its ridiculous. Don't want to do them over and over. Plus, my appeal to the game has switched to the code behind mafia scripts, and the new content I witness with my new account (which I don't use mafia for).
 

monster hunter

New member
Here's the script at its current state, meant to do everything (almost) for me & anyone else that can configure it :)

Thank you guys a bunch. I went from 0 to being able to write this, thanks to you. I just ran it, and it works amazingly :)

I'll be working on some future functionality, and will be lurking/posting in the kolmafia forum thread as needed.

Code:
#### FUTURE FUNCTIONALITY:
## [] Perform differently for different accounts
## [] Bounty Hunter quests
## [ X ] Castlefarm
## [] Libram management.
## [] Wait for wads to appear.


#### THANK YOU
## me259259
## Theraze
## Bale //send him stuffed hodgemen.
## roippi
## lostcalpolydude
## slyz
## & SinginSally for the amazing KoLMafia Guide for Newbs (http://kolmafia.us/showthread.php?3397-KolMafia-Guide-for-Noobs/)
## & the KoLMafia devs!!


void main ()
{
  #### Obtain Ode to Booze for drinking.
  ## Modify by sending the right meat amount to your buffBot of choice.
  if(have_effect($effect[Ode to Booze]) < 1)
  {
   cli_execute("csend 1 meat to Testudinata");
  }
  
  
  #### Wait for the buff to appear.
  if(have_effect($effect[Ode to Booze]) < 1)
  {
   repeat {wait(5); refresh_status();}
   until (have_effect($effect[Ode to Booze]) > 1);
  }
  

  #### Buy & Drink Booze.
  if(item_amount($item[Shot of Peach Schnapps]) < 9)
  {
    buy( 9 - item_amount( $item[Shot of Peach Schnapps]) , $item[Shot of Peach Schnapps]);
  }
  cli_execute("drink 9 Shot of Peach Schnapps");

  
  #### Buy & Use Milk of Magnesium
  if(item_amount($item[Milk of Magnesium]) < 2)
  {
    buy( 2 - item_amount( $item[Milk of Magnesium]) , $item[Milk of Magnesium]);
  }
  cli_execute("use 2 Milk of Magnesium");
  
  
  #### Buy & Eat food.
  if(item_amount($item[Spooky hi Mein]) < 3)
  {
    buy( 3 - item_amount( $item[Spooky hi Mein]) , $item[Spooky hi Mein]);
  }
  cli_execute("eat 3 Spooky hi Mein");
  
  
  #### Buy & Use spleen items.
  if(item_amount($item[Twinkly Wad]) < 15)
  {
    buy( 15 - item_amount( $item[Twinkly Wad]) , $item[Twinkly Wad]);
  }
  cli_execute("use 15 Twinkly Wad");
  
  
  #### Maximize your meat drop.
  cli_execute("maximize meat drop");
  
  
  ## Adventure in the Giant's Castle!!
  cli_execute("adventure * Giant's Castle");
  
  
  #### Obtain Ode to Booze for overdrinking.
  ## Modify by sending the right meat amount to your buffBot of choice.
  cli_execute("csend 1 meat to Testudinata");

  
  #### Wait for the buff to appear.
  if(have_effect($effect[Ode to Booze]) < 1)
  {
   repeat {wait(5); refresh_status();}
   until (have_effect($effect[Ode to Booze]) > 1);
  }
   
   
  #### Drink your nightcap! (overdrinking)
  ## Modify by changing the drink.
  if(item_amount($item[Bucket of wine]) == 0)
  {
    buy( 1 , $item[Bucket of wine]);
  }
  cli_execute("overdrink Bucket of wine");
  
  
  #### Send waddable Giant's Castle items to Wadbot
  ## "*" means all of that item, and can be replaced with a value.
  cli_execute("send * wolf mask, * giant needle to wadbot || wad");
  
  
  #### Wait for wads to appear.
  #if(item_amount($item[Twinkly Wad]) < 1)
  #	repeat {wait(5); refresh_status();}
  #	until (item_amount($item[Twinkly Wad]) > 1);
  
  
  #### Mallsell recieved Twinkly Wads
  ## Modify: mallsell [#] <itemname> @ <price> limit <limit>
  #cli_execute("mallsell -15 Twinkly Wad @ 350 limit 15");
  
  
  #### Use Warm Subject Gift Certificates
  ## You'll get more money this way than if you autosell
  cli_execute("use * Warm Subject gift certificate");
  
  
  #### Autosell remaining Giant's Castle Items
  cli_execute("autosell * heavy D, * original G, * disturbing fanfic, * furry fur, * awful poetry journal, * thin black candle, * chaos butterfly, * plot hole, * probability potion, * procrastination potion, * angry farmer candy, * Mick's IcyVapoHotness Rub, * rave whistle");

  
  #### Check/buy/equip +adventure equipment
  ## This will not buy the equipment if you already have it
  if (item_amount($item[sword behind inappropriate prepositions]) == 0)
  {
    buy( 1 ,$item[sword behind inappropriate prepositions]);
  }
  if ( have_skill( $skill[ Torso Awaregness ] ) ) 
  {
    if(available_amount($item[General Sage Lonely Diamonds Club Jacket])==0)
    {
        buy( 1, $item[ General Sage Lonely Diamonds Club Jacket ] );
    }
    equip( $item[ General Sage Lonely Diamonds Club Jacket ] );
  }  
  if (item_amount($item[paperclip pants]) == 0)
  {
	buy( 25 , $item[paperclip]);
	use( 25 , $item[paperclip]);
  }
  if (item_amount($item[BGE pocket calendar]) == 0)
  {
	buy( 1 , $item[BGE pocket calendar]);
  }
  if (item_amount($item[dead guy's watch]) == 0)
  {
	buy( 1 , $item[dead guy's watch]);
  }
  if (item_amount($item[tiny plastic bitchin' meatcar]) == 0)
  {
	buy( 1 , $item[tiny plastic bitchin' meatcar]);
  }
  cli_execute("maximize adv");
  
  
  #### Refreshes your status completely, just in case KoLmafia got lost along the way
  cli_execute("status refresh");


  #### This will print the message in the ""
  print("The script is done running, you know. You can go outside, or you could have gone outside when it was running. Oh well, you sat there and watched the nothing happen. Greasy paste & fiddlesticks.");
}
 

holatuwol

Developer
Would you mind explaining the general stigma against automating bounty-hunting? Or is that not a thing and I'm just confused by this thread:
Well, one of the reasons is that the script was released just a little over a month after NS-13 was released, and there was a lot of NS-13 stuff that I did not want to see automated at all. As for why, it felt self-defeating if these forums encouraged skipping NS-13 content when KoLmafia was originally created with the hope of helping people stick around for NS-13. As others have noted, it's been five years, and KoLmafia's project direction shifted a lot after NS-13 hit almost five years ago, so the post you quoted is no longer relevant.

For additional background history (while I'm here), I also recall that I was so strongly against letting KoLmafia impact the gameplay of NS-13 that, after discovering that KoLmafia was broken by some character pane changes right after NS-13 hit, I hid KoLmafia's downloads on Sourceforge as well as the entire daily builds forum (people manually built those back in those days and uploaded them as attachments, rather than the automated build process that we have today) for a week or two right after NS-13 because of the crazy lag we were experiencing in-game at the time. As for why I went to that extreme, a post on Gameplay Discussions really irked me since it talked about farming the castle with alts in the middle of all that crazy lag!

Of course, I later discovered that once we had the character pane fixed, people had been doing their own builds and releasing them to their clans because people had gotten so used to the help that KoLmafia was providing to them in the form of adventure automation and item management. I loosened up a bit on KoLmafia's general usage after learning that and I put in a few features to make it less painful to do bounty hunts (auto-selecting a bounty location) and a few other NS-13 things that people wouldn't really notice (auto rehydration in the desert), but still resisted full-blown scripting because to me it was still "new content".

Which brings up the second reason, which is that I also strongly object to automation of new content. I continued resisting new content automation while I worked on the project. Then I stopped playing the game and then stopped working on KoLmafia for a few years, and Veracity's less tyrannical bent on the issue has prevailed since then.

But yes, as Veracity mentioned, my philosophy when approaching KoLmafia doesn't really like full-blown adventure automation aspect of it (though that's a lot of what it does). For example, stuff that literally plans out your entire day for you from square one without interaction from you feels off to me. However, I'm not completely ignorant of why people do it. I wrote some softcore ascension scripts as NS-13 approached, and it was some pretty crazy number crunching and theory testing, and I understand that people enjoy that sort of thing. Others just don't have time or are just waiting around for new content. I just don't like the idea of full automation (in spirit, at least), but we can agree to disagree.

Veracity got used to me being unreasonably difficult about arbitrary things pretty fast; you can too! ^_~

Also, the feature that limits KoLmafia running instances per working folder was added around that time. Part of it was because I didn't want people firing up a ton of KoLmafia instances running them in parallel (creating more lag), and part of it was because I knew that when people did that, preferences would not work reliably since you could have preference file corruption. With the NS-13 lag, people were a lot more likely to try parallelizing, thus both problems were in play. Lag isn't a problem anymore (at least, as far as I know), but file locks for preferences and suchlike still are problematic, and so the limit is still in effect.
 

Theraze

Active member
Yep. CanAdv is basically just a library-script to tell other scripts (or you, if you call it directly) if you can adventure in a given zone. Scripts like zarqon's bounty script use it to decide which area is the best place you can actually adventure in successfully with a minimum amount of wasted server hits.
 

monster hunter

New member
Guys. Getting an error I don't understand at all.

Code:
Expected }, found null (login2.ash, line 215)

Here is login2.ash

Code:
#### FUTURE FUNCTIONALITY:
## [] Perform differently for different accounts
## [ X ] Bounty Hunter Hunter quests
## [ X ] Castlefarm
## [ X ] Diet: drink to cap & leave space for cookies
## [] Semi-rare mall management
## [] Banishing monsters while castlefarming (maybe)
## [] Libram management
## [] Wait for wads to appear
## [] Melange farming (maybe... most likely not)
## [] Add the rest of the websites


#### THANK YOU
## me259259
## Theraze
## Bale //send him stuffed hodgemen.
## roippi
## lostcalpolydude
## slyz
## & SinginSally for the amazing KoLMafia Guide for Newbs (http://kolmafia.us/showthread.php?3397-KolMafia-Guide-for-Noobs/)
## & the KoLMafia devs!!


#### WEBSITES
## Bale's counterchecker.ash: http://kolmafia.us/showthread.php?2519-CounterChecker-Wormwood-Semi-rares-Dance-Cards-and-more
## KoL Mafia noobie guide: http://kolmafia.us/showthread.php?3397-KolMafia-Guide-for-Noobs/


  #### Imports ZLib for some extra ASH goodness sauce.
  import <zlib.ash>

void main ()
{  
  #### Set your counter script to CounterChecker.ash See CounterChecker.ash for wormwood instructions, or the link above.
  cli_execute("set counterScript = CounterChecker.ash");
  cli_execute("set wormwood = not-a-pipe");
  
  
  #### Obtain Ode to Booze for drinking.
  ## Modify by sending the right meat amount to your buffBot of choice.
  if(have_effect($effect[Ode to Booze]) < 1)
  {
   cli_execute("csend 1 meat to Testudinata");
  }
  
  
  #### Wait for the buff to appear.
  if(have_effect($effect[Ode to Booze]) < 1)
  {
   repeat {wait(5); refresh_status();}
   until (have_effect($effect[Ode to Booze]) > 1);
  }
  

  #### Buy & Drink Booze.
  if(item_amount($item[Shot of Peach Schnapps]) < 9)
  {
    buy( 9 - item_amount( $item[Shot of Peach Schnapps]) , $item[Shot of Peach Schnapps]);
  }
  if(item_amount($item[Can of Swiller]) < 1)
  {
    buy( 1 , $item[Can of Swiller]);
  cli_execute("drink 9 Shot of Peach Schnapps");
  cli_execute("drink 1 Can of Swiller");
  
  
  #### Buys fortune cookies. This will keep them at a steady amount of 10.
  if(item_amount($item[fortune cookie]) < 10)
  {
    buy( 10 - item_amount( $item[fortune cookie]) , $item[fortune cookie]);
  }
  
  
  #### Magnesium to the MAX
  if(item_amount($item[Milk of Magnesium]) < 2)
  {
    buy( 2 - item_amount( $item[Milk of Magnesium]) , $item[Milk of Magnesium]);
  }
  cli_execute("use 2 Milk of Magnesium");
  
  
  #### Buy & Eat food. 3 fullness will be for fortune cookies.
  if(item_amount($item[Spooky hi Mein]) < 2)
  {
    buy( 2 - item_amount( $item[Spooky hi Mein]) , $item[Spooky hi Mein]);
  }
  cli_execute("eat 2 Spooky hi Mein");
  if(item_amount($item[knob ka-bob]) < 2)
  {
    buy( 2 - item_amount( $item[knob ka-bob]) , $item[knob ka-bob]);
  }
  cli_execute("eat 2 knob ka-bob");
  cli_execute("eat 1 fortune cookie");
  
  
  #### Buy & Use spleen items.
  if(item_amount($item[Twinkly Wad]) < 15)
  {
    buy( 15 - item_amount( $item[Twinkly Wad]) , $item[Twinkly Wad]);
  }
  cli_execute("use 15 Twinkly Wad");
  
  
  #### Maximize item drop for the BHH.
  use_familiar(best_fam("item"));
  cli_execute("maximize item");
  
  
  #### Bounty hunt!
  cli_execute("call bounty.ash");
  
  
  #### Maximize your meat drop.
  use_familiar(best_fam("meat"));
  cli_execute("maximize meat drop");
  
  
  ## Adventure in the Giant's Castle!!
  cli_execute("adventure * Giant's Castle");
  
  
  #### Obtain Ode to Booze for overdrinking.
  ## Modify by sending the right meat amount to your buffBot of choice.
  cli_execute("csend 1 meat to Testudinata");

  
  #### Wait for the buff to appear.
  if(have_effect($effect[Ode to Booze]) < 1)
  {
   repeat {wait(5); refresh_status();}
   until (have_effect($effect[Ode to Booze]) > 1);
  }
   
   
  #### Drink your nightcap! (overdrinking)
  ## Modify by changing the drink.
  if(item_amount($item[Bucket of wine]) == 0)
  {
    buy( 1 , $item[Bucket of wine]);
  }
  cli_execute("overdrink Bucket of wine");
  
  
  #### Send waddable Giant's Castle items to Wadbot
  ## "*" means all of that item, and can be replaced with a value.
  cli_execute("send * wolf mask, * giant needle to wadbot || wad");
  
  
  #### Wait for wads to appear.
  #if(item_amount($item[Twinkly Wad]) < 1)
  #	repeat {wait(5); refresh_status();}
  #	until (item_amount($item[Twinkly Wad]) > 1);
  
  
  #### Mallsell recieved Twinkly Wads
  ## Modify: mallsell [#] <itemname> @ <price> limit <limit>
  #cli_execute("mallsell -15 Twinkly Wad @ 350 limit 15");
  
  
  #### Use Warm Subject Gift Certificates
  ## You'll get more money this way than if you autosell
  cli_execute("use * Warm Subject gift certificate");
  
  
  #### Autosell remaining Giant's Castle Items
  cli_execute("autosell * heavy D, * original G, * disturbing fanfic, * furry fur, * awful poetry journal, * thin black candle, * chaos butterfly, * plot hole, * probability potion, * procrastination potion, * angry farmer candy, * Mick's IcyVapoHotness Rub, * rave whistle");

  
  #### Check/buy/equip +adventure equipment
  ## This will not buy the equipment if you already have it
  if (item_amount($item[sword behind inappropriate prepositions]) == 0)
  {
    buy( 1 ,$item[sword behind inappropriate prepositions]);
  }
  if ( have_skill( $skill[ Torso Awaregness ] ) ) 
  {
    if(available_amount($item[General Sage Lonely Diamonds Club Jacket])==0)
    {
        buy( 1, $item[ General Sage Lonely Diamonds Club Jacket ] );
    }
    equip( $item[ General Sage Lonely Diamonds Club Jacket ] );
  }  
  if (item_amount($item[paperclip pants]) == 0)
  {
	buy( 25 , $item[paperclip]);
	use( 25 , $item[paperclip]);
  }
  if (item_amount($item[BGE pocket calendar]) == 0)
  {
	buy( 1 , $item[BGE pocket calendar]);
  }
  if (item_amount($item[dead guy's watch]) == 0)
  {
	buy( 1 , $item[dead guy's watch]);
  }
  if (item_amount($item[tiny plastic bitchin' meatcar]) == 0)
  {
	buy( 1 , $item[tiny plastic bitchin' meatcar]);
  }
  cli_execute("maximize adv");
  
  
  #### WANG yourself, right in the *******
  cli_execute("buy 1 wang");
  cli_execute("use 1 wang");
  
  
  #### Refreshes your status completely, just in case KoLmafia got lost along the way
  cli_execute("status refresh");


  #### This will print the message in the ""
  print("The script is done running, you know. You can go outside, or you could have gone outside when it was running. Oh well, you sat there and watched the nothing happen. Greasy paste & fiddlesticks.");
}

I don't understand. My head's about to explode. What is this "null" thing? And why is mafia finding it instead of the bracket that is right there.
 

AlbinoRhino

Active member
The missing brace is actually after:

"cli_execute("drink 1 Can of Swiller");"

or perhaps, the "buy", depending.
 

Winterbay

Active member
Guys. Getting an error I don't understand at all.

Code:
Expected }, found null (login2.ash, line 215)

I don't understand. My head's about to explode. What is this "null" thing? And why is mafia finding it instead of the bracket that is right there.

AlbinoRhino already answered what you can do to solve it, but to answer your implied question: Null is what Mafia (and java and lots of other things) call "nothing". When the ash-compiler reaches the end of your script without finding a matching brace it'll find "nothing" and inform you about it. So in a way it's a complicated way of saying "Your script is lacking a closing brace somewhere in it".
 
Top