Best Between Battle Script Ever -- formerly AutoMCD

Wow, an excellent reply!

With that explanation, I think I've gathered what can_interact() does now. That's some pretty clever code!

And re: changes to optimal eau de tore timing. I look forward to your changes. :) Sure, I may not get some use of it in this extended aftercore, but I'm sure I'll find my self nickel farming as a TT in the next few months. Thanks!
 
Sorry to bug you so much, but I have another set of questions. :)

The puttying feature for bounties has completely failed to work for me. Well, that's not entirely true, as FTF seems to fire, and actually putty the appropriate bounty monster. Between battles, however, the character will continue to adventure in the area, and leave the putty with the monster within.

Notes:
Using the version of bounty.ash with modifications by Raorn and Zarqon
FTF, BBB, etc. are all up to date (perhaps caused by a new version of BBB?)
Character recently grabbed olfaction
No combat macros are being used, yet

Again, a quick look at fight_items() and I still can't figure out why it's failing. Thanks again. :)
 
I've run into this same problem, but haven't had time to debug. I suspect it has to do with checking for conditional drops in has_goal(). I'll fix it when I have time... ninjas welcome!
 
Last edited:
The code for spooky putty monsters looks pretty good to me. XD

The one thing that troubles me, is why does the function return fight_items() after using a putty monster? Is the recursion necessary? Does mafia not call a between battle script after using an item? If so, they why don't you do something similar after using cameras or dolphin whistles?

However, just above the putty monster code is code that is less good:

Code:
   switch (have_effect($effect[absinthe-minded])) {
     case 0: case 10: case 6: case 2: break; default: return vprint("Avoiding possible Wormwood conflict, not fighting items.",6);
   }
The second wormwood encounter is on turns 5-4, not turns 5-3, so that should be:

Code:
   switch (have_effect($effect[absinthe-minded])) {
     case 0: case 10: case 6: case 3: case 2: break; default: return vprint("Avoiding possible Wormwood conflict, not fighting items.",6);
   }

Then there is this error:

Code:
   if (item_amount($item[shaking 4-d camera]) > 0 && has_goal(to_monster(get_property("cameraMonster"))) > 0)
      use(1,$item[shaking 4-d camera]);
You forgot to check if a camera has been used yet today. Make that:

Code:
   if (item_amount($item[shaking 4-d camera]) > 0 && get_property("_cameraUsed") == "false" && has_goal(to_monster(get_property("cameraMonster"))) > 0)
      use(1,$item[shaking 4-d camera]);
 
I'm pretty sure that if it's an error with has_goal(monster) and it's related to bountying, then it's the distinct lack of 'case "b": return 1;' right around line 236 of ZLib (where that switch is). (No support for bounty-based items).

While we're pointing out errors with ZLib, I don't think the to_element() function is required any more.
 
Last edited:
Found the problem! has_goal(monster) is buggy! I found two bugs. One of them was responsible for this problem. Try this:

Code:
float has_goal(monster m) {                      // chance of getting a goal from a monster
   float res, temp;
   foreach num,rec in item_drops_array(m) {
      temp = has_goal(rec.drop);
      if (temp == 0) continue;
      switch (rec.type) {
         case "p": if (my_primestat() == $stat[moxie] || have_effect($effect[Form of...Bird!]) > 0)
            res = res + temp*minmax(rec.rate*(numeric_modifier("Pickpocket Chance")+100)/100.0,0,100)/100.0; continue;
         [COLOR="#ff0000"]case "b": res = res + 1.0; continue;[/COLOR]
         case "c": if (!is_displayable(rec.drop) || (item_type(rec.drop) == "shirt" && !have_skill($skill[torso awaregness]))) continue;
         case "": [COLOR="#ff0000"]if (my_primestat() == $stat[moxie] || have_effect($effect[Form of...Bird!]) > 0)
            res = res + temp*minmax(rec.rate*(numeric_modifier("Pickpocket Chance")+100)/100.0,0,100)/100.0;[/COLOR]
         case "n": res = res + temp*minmax(rec.rate*(item_drop_modifier()+100)/100.0,0,100)/100.0;
      }
   }
   return res;
}

I added the stuff in red. I think you see why bounty monsters were not puttying. It was returning 0 for goals of type "b".

Edit: It seems that I partially half-ninja'ed by heeheehee. (Though heeheehee's solution is naive as zarqon is adding up for all goals, not just bounties.)
 
Last edited:
Yep, I figured it was something like that. I initally copied the switch from FTF's monster_value(), which ignores bounty items. I'd forgotten there was a separate type for that -- was thinking they were part of "c".

And while we're being picky, you were both a little off. It should be:

PHP:
          case "b": res += temp; continue;

heeheehee's fix would have stopped counting goals whenever it considered any bounty item; Bale's solution would have considered all possible bounty items goals, even ones you weren't hunting.

To address other issues:

1) Wormwood. Looking at session logs from a character farming !pipes, you appear to be correct. I was suspicious because I have a set_avg() hook in my wormwooding that tracks spare adventures. From three characters: 4.49:343 , 4.53:2440 , 4.45:331

So, over 3000 wormwood iterations says that you get an average of 4.5 adventures outside the Wormwood per absinthe. Of those, turns 10, 6, and 2 are always outside, leaving 1.5 to come from elsewhere. If 3 was also always outside, that would mean that turns 9, 8, 7, and 5, 4 would only average 0.5 turns outside the wormwood, giving only a 0.1666... chance (0.5 / 3) of encountering the choiceadv. Seemed less reasonable than a 0.375 chance (1.5 / 4), but session logs don't lie. Or at least, they lie less than my assumptions do. :)

2) 4-d camera usage check. Yes, excellent.

3) to_element(). Oooh it's in ASH now! When did that happen? Unfortunately, this doesn't return $element[hot] for the word "heat" -- a common case. Everything has still been working -- evidently you can redeclare ASH functions? Which one gets executed? Curious.

4) fight_items() recursion. Recursion was necessary a) because BBB is called once, before adventuring, not after fighting an item, and 2) to perform all the counter/goal checks again, efficiently. And if you think about it, I'm pretty sure you'll grasp why it doesn't recurse for unrepeatable combats. :)

5) Bale's fix to has_goal(monster): Your addition of pickpocketing for normal drops had at least two problems. First, rec.rate is only the pickpocket rate for type "p"; for normal drops, it's the normal drop rate. Further, unlike regular drops, you can't get multiple items, so the sum pickpocketing goal-ness should be divided by the number of pickpocketable drops. And further yet, the formula for pickpocket chance is far more complicated than regular item drops. Perhaps you understand now why I haven't added that yet. Your code would have yielded a drastically overoptimistic result for moxie classes.

(Using this code and looking for white pixels as a DB with +45% items: has_goal(blooper) returned 4.97! What you say!)

The has_goal() bounty item problem is a rather glaring bug and will be fixed promptly. Other issues 1 and 2 will be in the next BBB update. I will remove/alter to_element() after I decide how/if this overloading of ASH functions works. Accounting for pickpocketing normal drops in has_goal() will happen someday, someday.

EDIT: Ok, so you can't redeclare ASH functions. They just get ignored. That should be an error, methinks. DDD is broken now for "heat" tests.
 
Last edited:
5) Bale's fix to has_goal(monster): Your addition of pickpocketing for normal drops had at least two problems. First, rec.rate is only the pickpocket rate for type "p"; for normal drops, it's the normal drop rate. Further, unlike regular drops, you can't get multiple items, so the sum pickpocketing goal-ness should be divided by the number of pickpocketable drops. And further yet, the formula for pickpocket chance is far more complicated than regular item drops. Perhaps you understand now why I haven't added that yet.

How does mafia calculate normal drops with pickpocket? (they show on the location details page). Maybe ask for API for that too?
 
I tested the whole re-declaring of ASH functions a while back. If you say,
Code:
int random(int a) {
    return 4;
}
the built-in function always gets executed.

Heck, then I tried...
Code:
string random(int a) {
    return "HELLO";
}
And it still executed the ASH function. Darn!
 
Is there any way to stop the script from trying to reset the MCD every turn while in BM?

Hmm... looks like a check for that should probably get added into zlib...
Probably change line 353 in zlib.ash from
Code:
if (!to_boolean(vars["automcd"]) || (my_ascensions() < 1)) return true;
to
Code:
if (!to_boolean(vars["automcd"]) || (my_ascensions() < 1) || in_bad_moon()) return true;
 
While you wait for Zarqon to implement StDoodle's suggestion, apparently you can simply set the zlib var automcd to false, by typing zlib automcd = false in the gCLI.
 
I'm quite behind in updating my scripts. But yes, the next version will have updated handling (or at the very least, no handling) for the Spooky Forest choice tree. It will take a bit of research to put together. If anyone with more time than me cares to post a "patch" of sorts, that would speed things along.
 
I'm quite behind in updating my scripts. But yes, the next version will have updated handling (or at the very least, no handling) for the Spooky Forest choice tree. It will take a bit of research to put together. If anyone with more time than me cares to post a "patch" of sorts, that would speed things along.

I'm not even sure how to detect all the various things necessary to determine what to do in the forest without constantly hitting up the quest log. It might be impossible. No handling is probably best.
 
As I understand it, mafia will override BBB for quest items if there are appropriate conditions set...?
 
Well, depends on what you're doing... choice tree or condition. I usually mark choice tree, forgetting that BBB will kill it immediately. :D

What should probably eventually get set would be the quest tree... As I'm pondering, I'd probably suggest larva first to finish level 2, then tree coin (since that gives 300 meat as well), using the coin to get the map, fertilizer, to the bar hunter for the sapling (since you got 300 meat from the coin, you can afford the 100 even if you haven't killed any bar)... if it's possible to automate, probably auto-sell all bar skin and then buy the tree... then get the wooden stakes, a stolen accordion (for the eventual NS entryway), and leave the final goal on either spices or skip adventure...
 
How is the script to know if you've gotten the larva without checking the quest log? How does it know whether you need to get the coin or you've already opened the temple? Perhaps I'm missing something obvious and you're gaping at my foolishness, but I think that these are problems and constantly checking the quest log is not a good solution.
 
This is still possible using goals. The only difficulty is what should take precedence when no tree-specific goals are set. Off the top of my head, I'd think getting totem/accordion to cast any available skills first -- although getting bottles of blood if you have the requisite amount of vampire hearts may be better.
 
Back
Top