BatBrain -- a central nervous system for consult scripts

Winterbay

Active member
Man that was a lot of stuff to synch with my bloatified version of BatBrain (more line breaks and {}s :)).
It looks amazing though. I hope to get to play with it sometime when my life becomes less hectic.
 

shazbot

Member
EDIT: Nevermind, verbosity 9 + stocking mimic = ludicrous amount of messages that causes my mafia to seize.
 
Last edited:

Boogaloogaloo

New member
There is a condition (lines 944 and 955 of version 1.0) in the action filter for choosing whether or not to whip the guard turtles that doesn't seem right. Maybe I'm reading it wrong, but I can't see any reason why it should be there.

Anyhow, removing the highlighted condition fixes the handling of guard turtles.

Code:
   if (have_equipped($item[fouet de tortue-dressage]) && my_location() == $location[outer compound] &&   // un-brainwash turtles

       (contains_text(action,"frenchturtle.gif") [b]|| get_property("lastNemesisReset").to_int() == my_ascensions()[/b]) && my_stat("mp") >= 5*mp_cost($skill[apprivoisez la tortue])) {
 

zarqon

Well-known member
Yeah, that's backwards. We want to whip only French turtles during the Nemesis quest, then all turtles after that. I'll just change it to check for a Flail of the Seven Aspects instead.
 

Winterbay

Active member
Hmm... Say I enqueue a couple of skills and then want to try a new set of skills, or exchange one of the enqueued ones.. Is there a way to revert BatBrain's knowledge of monster stats and player stats to pre-queueing?

A sort of reset()/revert() function perhaps.

Edit: Had an idea, but it appears to not be working. It enqueues empty things all the time :(
 
Last edited:

slyz

Developer
I found a bug in m_dpr(). The explanation is posted in the SmartStasis thread, but I'm posting here to make sure Zarqon doesn't miss it.

m_dpr() should be changed to:
PHP:
float m_dpr(float att_mod, float stun_mod) { 
   adj.att += att_mod; 
   adj.stun += stun_mod; 
   float res = m_hit_chance()*m_regular(); 
   adj.att -= att_mod; 
   adj.stun -= stun_mod; 
   return res; 
}
 

zarqon

Well-known member
@slyz: That won't work -- it fails to account for unknown stat adjustment and existing multi-round stuns.

Updates coming soon -- but I'm playing a music festival this weekend so all my time right now is going into that. My first time playing on this huge a stage to this huge a crowd -- it's very exciting even if I am just one of the afternoon "filler" bands!

Upcoming additions to BatBrain:

int kill_rounds(advevent)
int kill_rounds(spread)
int die_rounds()
void clear_queue()
 

slyz

Developer
@slyz: That won't work -- it fails to account for unknown stat adjustment and existing multi-round stuns.
I don't understand. Neither does the current m_dpr() then ? Wasn't the purpose of "temp" to return "adj" to its previous state after computing m_hit_chance()*m_regular() ?

EDIT: Break a leg!
 
Last edited:

Bale

Minion
Updates coming soon -- but I'm playing a music festival this weekend so all my time right now is going into that. My first time playing on this huge a stage to this huge a crowd -- it's very exciting even if I am just one of the afternoon "filler" bands!

I'm never going to be able to look at a banana the same way again. :eek:

Please break two legs! Hopefully, other people's legs.
 

Bale

Minion
Winterbay, I'm in a myst run so I'm finally biting my teeth into your spamattack spellmacroing script. Could you tell me why your script has special fear of giants? I don't get it. I suppose if it was just for Procrastination Giants I could understand, but why all giants?
 

Winterbay

Active member
Well, it's me being lazy I think :)
It is the procrastination giants fault and should probably be changed to "if(m == $monster[procrastination giant])" instead of the check for "giant". Also, the version I have on my computer is broken (so I hope that isn't the version I uploaded here...) due to my restoring subs not being where I want them to be but I have no time to fix this until possibly next week (unless I get time over and internet on the trains I'll be on today and tomorrow).
 

Bale

Minion
It looks like the mp restoration is a bit weird. I'll take a look at fixing that later.

So far I've modded it a tiny bit though to play nice with FinalAttack. I then imported your script into mine to handle spell casting when attacks won't hit and I don't want to sauce spash. I'm pretty happy with the result though I'll probably play around with it a bit more.

In case you're curious I'll attach our children here. You might be interested in the way I changed the main function of your script and exported the logic to a subroutine for use with FinalAttack.
 

Attachments

  • FinalAttack.ash
    5.3 KB · Views: 46
  • spellKill.ash
    13 KB · Views: 40

Winterbay

Active member
Yeah, the main function would need changing in order to work as an import since it is set up to be used as a consult-script which has a specific set up in the main function :)

I'll download it and see if I get to poke at it during the train ride. Could be interesting.
 

Rinn

Developer
I'm looking around and I think it would be more prudent to have a version of hitchance that you would pass an action into instead of your magic number integer. I feel like in it's current form someone would get confused as to what needs to be passed in without looking at batbrain's source.
 

Bale

Minion
tl;dr: I agree with Rinn.

Longer version: The problem is that "attack" is not a skill. :( That means you would need to pass it a string. Of course if the action is not "attack" you can do skillname.to_string() to convert it and have an overloaded form that accepts a skill. It would be loads less confusing than passing an int completely unrelated to its meaning.
 

Rinn

Developer
I would assume that an empty version that takes no arguments would be use for attack, it's not like the function couldn't be overloaded for both strings and $skills.
 

zarqon

Well-known member
That's pretty much a private/internal function; you shouldn't really need to use that function in a consult script. Your hit chance is already inluded in all of the options which have one (to BB's knowledge). Show me some examples where it's needed and you'll have a case.
 

Winterbay

Active member
I use it in my script to decide if I should attack the monster or cast spells at it as such:
Code:
//Check if we should just attack the monster instead of spellslinging
boolean will_attack(monster foe)
{
	float rounds;
	boolean no_attack = foe == $monster[procrastination giant] || contains_text(to_lower_case(to_string(foe)), "quantum");
	
	if(get_action("attack").id != "")
	{
		vprint("You have " + hitchance(1) * 100 + "% chance to hit the monster", "purple", 7);
		if(dmg_dealt(get_action("attack").dmg) > 0 && hitchance(1) > 0.8)
		{	//How many rounds will it take me to kill the monster by attacking
			rounds = ceil(monster_stat("hp") / (dmg_dealt(get_action("attack").dmg) + m_hit_chance()*dmg_dealt(retal.dmg) + dmg_dealt(baseround().dmg)));
			vprint("Expected received damage per round: " + m_dpr(0,0) + ", Rounds to kill: " + rounds + ", Expected damage: " + dmg_dealt(get_action("attack").dmg) + ", Hit chance: " + hitchance(1),"purple",8);
			if(!no_attack && (ceil(my_hp() / m_dpr(0,0)) > rounds) && (rounds < 10)) //Do not attack if it isn't over quickly and do not attack giants
			{
				vprint("Monster is weak. We are just going to bash its head in. It'll take " + rounds + " rounds.", "purple", 2);
				return true;
			}
		}
	}
	return false;
}
 
Top