Page 3 of 210 FirstFirst 1 2 3 4 5 13 53 103 ... LastLast
Results 21 to 30 of 2091

Thread: BatBrain -- a central nervous system for consult scripts

  1. #21
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,370

    Default

    Were you checking to make sure your get_action() results weren't empty? It will return an empty event if the action is not in your available combat options.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******* (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer******** (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  2. #22
    Senior Member Winterbay's Avatar
    Join Date
    Feb 2010
    Posts
    5,033

    Default

    Isn't attacking always an option? Or is it disregarded if you cannot hit the monster?
    My scripts:
    Best sushi for Profit
    Winterbay's Helpful Automatic Monsterbasher (WHAM)

    Scripts maintained by me:
    Autobasement
    Smashlib

    A small programmer joke:
    Wife: Honey, please go to the market and buy 1 bottle of milk. If they have eggs, bring 6.
    The man came back with 6 bottles of milk.
    Wife: Why did you buy 6 bottles of milk.
    Man: Because they had eggs...

    The 6 Stages of Debugging: 1 )That can't happen. 2) That shouldn't happen. 3) Hmmm, weird. 4) Why does that happen? 5) Oh, I see. 6 )How did that ever work?

    All programs can be optimized, and all programs have bugs; therefore all programs can be optimized to one line that doesn’t work. /Bob Fitch, Blizzard

  3. #23
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,174

    Default

    I'm now invoking my powers as a Minion.
    Please note that this thread has a new first post.


    @Bale: well done; your example has convinced me to add the tweak you suggested right now. The alternative in your above example would be to add noodles to the queue and then spam the queue with dangeraction, then call macro(), which is slightly inelegant in that it ignores the capability of BALLS to spam actions on your behalf.

    I'm also going to clear the queue in macro() after executing it, so you need not bother clearing it anymore.
    Originally Posted by zarqon View Post
    Thank you. I was really trying to find a way to write this with the macro queue before I gave up and did it that way. Briefly I had a version that queued up noodles and dangeraction with macro(), then spammed dangeraction in case the first dangeraction. It was... inelegant.


    As far as whether you're using BatBrain correctly, yes. However, you are making unnecessary checks. If get_action() returns an empty event, the skill is unavailable. Otherwise, the skill is available. This will do the same as you posted:

    PHP Code:
    advevent dangeraction() {
       foreach 
    da in $strings[skill 7008skill 2005skill 4012attack]
          if (
    get_action(da).id != "") return get_action(da);
       return new 
    advevent;    // you should never reach this

    Oh. Oh wow. So I can count on BatBrain to recognize if a skill (like shieldbutt) is presently available! That's sweet.
    Last edited by Bale; 04-14-2011 at 09:05 PM.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  4. #24
    Senior Member Winterbay's Avatar
    Join Date
    Feb 2010
    Posts
    5,033

    Default

    Good initiative Bale. I quite like the forum software that allows you to do this
    My scripts:
    Best sushi for Profit
    Winterbay's Helpful Automatic Monsterbasher (WHAM)

    Scripts maintained by me:
    Autobasement
    Smashlib

    A small programmer joke:
    Wife: Honey, please go to the market and buy 1 bottle of milk. If they have eggs, bring 6.
    The man came back with 6 bottles of milk.
    Wife: Why did you buy 6 bottles of milk.
    Man: Because they had eggs...

    The 6 Stages of Debugging: 1 )That can't happen. 2) That shouldn't happen. 3) Hmmm, weird. 4) Why does that happen? 5) Oh, I see. 6 )How did that ever work?

    All programs can be optimized, and all programs have bugs; therefore all programs can be optimized to one line that doesn’t work. /Bob Fitch, Blizzard

  5. #25
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,636

    Default

    Managed to get negative rounds-to-kill count using the spamattack posted (currently) in thread 18, which sometimes ends in a division by zero error.

    Regarding how I got to that point, using a ranged weapon as a myst class to clean up the easy mobs, not a muscle weapon, which might be part of why your calculation line is getting off... since you don't have either the 3/4ths damage for ranged weapons being calculated, or the +ranged damage if weapon stat == moxie.

    Not sure exactly what's causing it, but BatBrain gives my expected damage above 10, while spamattack suggests I'll do 2...
    > ash import <batbrain> regular(1);

    Returned: aggregate float [element]
    none => 10.355

    > ash import <zlib> monster foe = to_monster(get_property("lastMonster")); float total_damage = min(floor(my_buffedstat($stat[muscle])) - monster_defense(foe), 0) + min(0.1 * get_power(equipped_item($slot[weapon])),1) + numeric_modifier("Weapon Damage") * (1 + to_float(numeric_modifier("Weapon Damage Percent"))/100.0) + min(0.1 * get_power(equipped_item($slot[offhand])),1);

    Returned: 2.0
    Believe the problem MAY be the various min... that means that you can never go higher than 0 for your muscle bonus-damage, can never have a weapon power above 1, and your offhand item (if it happens to be a weapon) can never go above 1... yeah, looks like that's probably the issue.

    So, here's a line that should work better.
    Code:
       total_damage = (max(floor((my_buffedstat($stat[muscle])) * (weapon_type(equipped_item($slot[weapon])) == $stat[moxie] ? .75 : 1)) - monster_defense(foe), 0) + max(0.1 * get_power(equipped_item($slot[weapon])),1) + numeric_modifier("Weapon Damage") + (weapon_type(equipped_item($slot[weapon])) == $stat[moxie] ? numeric_modifier("Ranged Damage") : 0)) * (1 + to_float(numeric_modifier("Weapon Damage Percent"))/100.0) + (to_slot(equipped_item($slot[offhand])) == $slot[weapon] ? max(0.1 * get_power(equipped_item($slot[offhand])),1) : 0);
    Comparison of after/before:
    > ash import <zlib> monster foe = to_monster("caustic bull"); int total_damage = (max(floor((my_buffedstat($stat[muscle])) * (weapon_type(equipped_item($slot[weapon])) == $stat[moxie] ? .75 : 1)) - monster_defense(foe), 0) + max(0.1 * get_power(equipped_item($slot[weapon])),1) + numeric_modifier("Weapon Damage") + (weapon_type(equipped_item($slot[weapon])) == $stat[moxie] ? numeric_modifier("Ranged Damage") : 0)) * (1 + to_float(numeric_modifier("Weapon Damage Percent"))/100.0) + (to_slot(equipped_item($slot[offhand])) == $slot[weapon] ? max(0.1 * get_power(equipped_item($slot[offhand])),1) : 0);

    Returned: 85

    > ash import <zlib> monster foe = to_monster("caustic bull"); int total_damage = min(floor(my_buffedstat($stat[muscle])) - monster_defense(foe), 0) + min(0.1 * get_power(equipped_item($slot[weapon])),1) + numeric_modifier("Weapon Damage") * (1 + to_float(numeric_modifier("Weapon Damage Percent"))/100.0) + min(0.1 * get_power(equipped_item($slot[offhand])),1);

    Returned: 2
    This also accounts for whether or not the item in the second hand is a weapon, if you are using ranged damage so your muscle bonus is only 75%, and that when using ranged damage, you also get bonuses from the 'ranged damage' modifier. Also, by adding more parenthesis, weapon damage percent should modify the entire weapon damage stack, not just the 'weapon damage' modifier.

  6. #26
    Senior Member Winterbay's Avatar
    Join Date
    Feb 2010
    Posts
    5,033

    Default

    Managed to get negative rounds-to-kill count using the spamattack posted (currently) in thread 18, which sometimes ends in a division by zero error.

    Regarding how I got to that point, using a ranged weapon as a myst class to clean up the easy mobs, not a muscle weapon, which might be part of why your calculation line is getting off... since you don't have either the 3/4ths damage for ranged weapons being calculated, or the +ranged damage if weapon stat == moxie.

    Not sure exactly what's causing it, but BatBrain gives my expected damage above 10, while spamattack suggests I'll do 2...Believe the problem MAY be the various min... that means that you can never go higher than 0 for your muscle bonus-damage, can never have a weapon power above 1, and your offhand item (if it happens to be a weapon) can never go above 1... yeah, looks like that's probably the issue.

    So, here's a line that should work better.
    Code:
       total_damage = (max(floor((my_buffedstat($stat[muscle])) * (weapon_type(equipped_item($slot[weapon])) == $stat[moxie] ? .75 : 1)) - monster_defense(foe), 0) + max(0.1 * get_power(equipped_item($slot[weapon])),1) + numeric_modifier("Weapon Damage") + (weapon_type(equipped_item($slot[weapon])) == $stat[moxie] ? numeric_modifier("Ranged Damage") : 0)) * (1 + to_float(numeric_modifier("Weapon Damage Percent"))/100.0) + (to_slot(equipped_item($slot[offhand])) == $slot[weapon] ? max(0.1 * get_power(equipped_item($slot[offhand])),1) : 0);
    Comparison of after/before:This also accounts for whether or not the item in the second hand is a weapon, if you are using ranged damage so your muscle bonus is only 75%, and that when using ranged damage, you also get bonuses from the 'ranged damage' modifier. Also, by adding more parenthesis, weapon damage percent should modify the entire weapon damage stack, not just the 'weapon damage' modifier.
    Originally Posted by Theraze View Post
    Well, yes. It's mainly programmed for me and as such it uses muscle as attack stat
    This version uses batbrain and does so in a way that avoids division by zero which shows up in there as well when the expected damage I can do with an attack is 0, it should also work with moxie weapons (or at least I think so since batbrain probably takes care of that...).

    Edit: The old version also had a parenthesis error in where it put the floor and does not take elemental damage bonuses into account.
    My scripts:
    Best sushi for Profit
    Winterbay's Helpful Automatic Monsterbasher (WHAM)

    Scripts maintained by me:
    Autobasement
    Smashlib

    A small programmer joke:
    Wife: Honey, please go to the market and buy 1 bottle of milk. If they have eggs, bring 6.
    The man came back with 6 bottles of milk.
    Wife: Why did you buy 6 bottles of milk.
    Man: Because they had eggs...

    The 6 Stages of Debugging: 1 )That can't happen. 2) That shouldn't happen. 3) Hmmm, weird. 4) Why does that happen? 5) Oh, I see. 6 )How did that ever work?

    All programs can be optimized, and all programs have bugs; therefore all programs can be optimized to one line that doesn’t work. /Bob Fitch, Blizzard

  7. #27
    Senior Member Winterbay's Avatar
    Join Date
    Feb 2010
    Posts
    5,033

    Default

    Ok, so double posting here, but since the last one is rather old...

    Is there a way to set the result of "last_monster()" to anything but the last monster? I wonder because if possible that would let me use batbrain to predict what type of damage I can do against a certain monster without having to fight it first. My consult script does this to a certain extent by allowing the use of the (foe)-versions of the different monster functions to adapt my numbers based on a given monster, but since batbrain seems useful I'd like to be able to incorporate more of that into my script, preferably without losing that ability.
    My scripts:
    Best sushi for Profit
    Winterbay's Helpful Automatic Monsterbasher (WHAM)

    Scripts maintained by me:
    Autobasement
    Smashlib

    A small programmer joke:
    Wife: Honey, please go to the market and buy 1 bottle of milk. If they have eggs, bring 6.
    The man came back with 6 bottles of milk.
    Wife: Why did you buy 6 bottles of milk.
    Man: Because they had eggs...

    The 6 Stages of Debugging: 1 )That can't happen. 2) That shouldn't happen. 3) Hmmm, weird. 4) Why does that happen? 5) Oh, I see. 6 )How did that ever work?

    All programs can be optimized, and all programs have bugs; therefore all programs can be optimized to one line that doesn’t work. /Bob Fitch, Blizzard

  8. #28
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,636

    Default

    Doesn't look like there's anything in RuntimeLibrary that will do SetNextMonsterName...

  9. #29
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,174

    Default

    I think you need to make a request for zarqon to overload BatBrain's functions for predictive usage. Though, the way he has it set up he'll have to refactor a lot of the code to implement.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  10. #30
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,636

    Default

    Well, might be able to just have a declaration like
    Code:
    monster my_monster = last_monster();
    and then replace all of the occurances of last_monster() with my_monster... then if you want to check on a different monster, just declare
    Code:
    my_monster = $monster[Something Else];
    in your BatBrain execution/alias...

Similar Threads

  1. Feature - Implemented random_attributes not being passed to consult scripts
    By DoctorRotelle in forum Bug Reports
    Replies: 7
    Last Post: 05-25-2015, 04:38 AM
  2. Replies: 25
    Last Post: 04-05-2015, 07:20 PM
  3. Feature - Implemented Duplicate scripts cause "not found" error for consult scripts
    By nightslide in forum Bug Reports
    Replies: 6
    Last Post: 06-10-2013, 07:07 PM
  4. Multiple consult scripts?
    By fxer in forum Scripting Discussion
    Replies: 2
    Last Post: 03-04-2013, 07:43 PM
  5. Passing variables to consult scripts from the ccs
    By Captain Kirk in forum Custom Combat Settings
    Replies: 0
    Last Post: 08-17-2008, 05:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •