Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 45

Thread: Help with a script

  1. #11
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    260

    Default

    Something along the lines of "numeric_modifier($item[cowboy boots],"adventures")" should do what you want.

    http://wiki.kolmafia.us/index.php?ti...meric_modifier
    Originally Posted by ereinion View Post
    I was just figuring that out, lol. I'm looking at the forum about moon phases, and grimacite equipment.

    http://kolmafia.us/showthread.php?18...ll=1#post11452

    EDIT:
    knowing THIS yesterday would have saved me a lot of time.
    PHP Code:
    float init numeric_modifier"adventures" );
    print(
    init " bonus adventures"); 
    lol, I went through, and coded each piece of rollover gear, and turns it would gain to figure out bonus roll over turns. I knew there had to be an easier way!
    Last edited by Pazleysox; 08-22-2017 at 12:59 PM.

  2. #12
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    260

    Default

    Is there an easy way to figure out what buffs a player currently has?

    I don't want to code checking for each single buff available.

    The script I'm working on tells you if you have free MP restorers available, and I want it to use them up.

  3. #13

    Default

    Code:
    ashref effect
    gave me a list that included the relevant function.

  4. #14
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    260

    Default

    I'm trying to burn extra MP at the end of my day. I found this code in the forums (somewhere):

    PHP Code:
    int [effectcurrentEffects my_effects();
        foreach 
    buff in currentEffects
            
    {
            
    skill currentEffect to_skill(buff);
                {
                
    cli_execute("cast " to_string(buff));
                }
            } 
    I think it was zarqon who wrote it, but I don't remember.

    This works really well to maintain all the buffs I currently have, with a few issues...
    I'm trying to use up all my free MP restorers (resting, oscus's soda, eternal battery, etc)

    I've got the code written to look for, and use available free MP restorers, but the above code doesn't like intrinsic effects, and stops when it reaches one.

    How can I get it to stop looking at the intrinsic buffs?

  5. #15
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    744

    Default

    I always like this fancy code:
    PHP Code:
    cli_execute("burn extra mp"); 
    There are a bunch of preferences on mana burning that control how this works. I don't remember right now, and my connection is slow, but prefref is your friend.

  6. #16
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,750

    Default

    Or if you want to burn down to exact amount of mp (antiundisirregardless of what your mana burn setting is):
    Code:
    burn -1234
    Also works for zero (note the minus):
    Code:
    burn -0

  7. #17
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    260

    Default

    Or if you want to burn down to exact amount of mp (antiundisirregardless of what your mana burn setting is):
    Code:
    burn -1234
    Also works for zero (note the minus):
    Code:
    burn -0
    Originally Posted by xKiv View Post
    Interesting. So, what's a good amount of MP to leave a player? At the moment, I have the script set to burn 50%, regardless of how much they have.

  8. #18
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,735

    Default

    If you're doing this for free restores, then the amount that will be restored. If you're doing this for other purposes, then detect how much their mp restoration is set to and make sure you leave them more than that. Because otherwise you can end up in an evil loop that sucks up all their meat.

  9. #19
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,355

    Default

    Also works for zero (note the minus):
    Code:
    burn -0
    Originally Posted by xKiv View Post
    Since I discovered that, I use it a lot, usually right before taking a free rest that will restore MP.

  10. #20
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,490

    Lightbulb

    Here's the code in my logout script to maximize using all your free sources of MP by burning the MP on casting your skills. Hopefully it will give you some good ideas, or inspire you to steal the code outright. Either or both would gratify me.

    It probably has some issues which I've never happened to discover, and some of the code (which mostly predates proxy records for skills) could be streamlined by using those instead of the data from classskills.txt. Feel free to suggest any improvements!

    PHP Code:
    // skill types
    // 0 - passive          not castable
    // 1 - summon           castable, oft limited, 1st pref
    // 2 - restore          not used here
    // 3 - char-only buff   castable, 2nd pref
    // 4 - buff             castable, 3rd pref
    // 5 - combat           not castable

    int max_castable(skill sk) {      // returns how many times you can possibly cast a given skill (NOT based on current MP)
       
    switch (sk) {
          case 
    $skill[Advanced Cocktailcrafting]: return 2*to_int(have_skill($skill[superhuman cocktailcrafting])) - to_int(get_property("cocktailSummons"));
          case 
    $skill[Pastamastery]: return 2*to_int(have_skill($skill[transcendental noodlecraft])) - to_int(get_property("noodleSummons"));
          case 
    $skill[Advanced Saucecrafting]: return 2*to_int(have_skill($skill[the way of sauce])) - to_int(get_property("reagentSummons"));
          case 
    $skill[Rainbow Gravitation]: return to_int(get_property("prismaticSummons"));
          case 
    $skill[Summon Hilarious Objects]: return to_int(get_property("grimoire1Summons") == "0");
          case 
    $skill[Summon Tasteful Items]: return to_int(get_property("grimoire2Summons") == "0");
          case 
    $skill[Summon Alice Army Cards]: return to_int(get_property("grimoire3Summons") == "0");
          case 
    $skill[Summon Snowcones]:
          case 
    $skill[Summon Stickers]:
          case 
    $skill[Summon Sugar Sheets]: return to_int(get_property("tomeSummons"));
          case 
    $skill[Summon Crimbo Candy]: return to_int(get_property("_candySummons") == "0");
      
    // candyHeartSummons??
       
    }
       if (
    mp_cost(sk) == 0) return 0;
       return 
    floor(my_maxmp() / mp_cost(sk));
    }

    // build list of castable skills
    record tskill {
       
    skill nome;
       
    int type;
       
    int irrint eleint vent;
    };
    tskill[intskills;
    file_to_map("classskills.txt",skills);
    print(
    "Your castable skills:","blue");
    foreach 
    i,s in skills {
       if (!
    have_skill(s.nome) || (s.nome.combat || s.type || s.type == 2) ||        // only types 1,3,4 that you have
           
    max_castable(s.nome) == || $ints[45,90,1025,3101,3102,3103,3104,3105,3106,] contains i ||  // casting limits, skip flavours, deep dark visions, rage gland
           
    (s.type && to_effect(s.nome) != $effect[none] && have_effect(to_effect(s.nome)) > 2000)) {  // skip buffs you have too much of
          
    remove skills[i]; continue;
       }
       print(
    i+": "+s.nome " ("+mp_cost(s.nome)+" MP) -- "+to_effect(s.nome));
    }

    int rest_mp() {             // calculate resting MP
       
    int[itemcampgear get_campground();
       if (
    numeric_modifier("Base Resting MP") < 40 && item_amount($item[Frobozz Real-Estate Company Instant House (TM)]) > && use(1,$item[Frobozz Real-Estate Company Instant House (TM)])) {}
       if (
    numeric_modifier("Base Resting MP") < 10 && retrieve_item(1,$item[Newbiesport&tradetent]) && use(1,$item[Newbiesport&tradetent])) {}
       if (!
    have_bartender()) print("You could get a bartender for an additional 15 MP/rest.","olive");
       if (!(
    campgear contains $item[beanbag chair])) print("You could get a beanbag chair for an additional 30 MP/rest.","olive");
       if (!(
    campgear contains $item[feng shui for big dumb idiots])) print("You could get some good Feng Shui for an additional 7 MP/rest.","olive");
       return 
    numeric_modifier("Base Resting MP") * (100+numeric_modifier("Resting MP Percent"))/100.0 numeric_modifier("Bonus Resting MP");
    }
    int restmp rest_mp();
    print(
    "Resting MP: "+restmp,"blue");

    int next_restore(boolean doit) {     // returns MP gained from next available free restore method, 0 if no methods available
       
    if (item_amount($item[platinum yendorian express card]) > && !get_property("expressCardUsed").to_boolean()) {
          if (
    doit) use(1,$item[platinum yendorian express card]);
          return 
    my_maxmp();
       }
       if (
    item_amount($item[license to chill]) > && !get_property("_licenseToChillUsed").to_boolean()) {
          if (
    doit) use(1,$item[license to chill]);
          return 
    my_maxmp();
       }
       if (
    my_level() > 11 && get_property("sidequestNunsCompleted") == "fratboy" && to_int(get_property("nunsVisits")) < 3) {
          if (
    doitcli_execute("nuns mp");
          return 
    min(1000,my_maxmp());
       }
       if (
    item_amount($item[clan vip lounge key]) > && !get_property("_aprilShower").to_boolean() && which_shower() == "hot") {
          if (
    doitcli_execute("shower hot");
          return 
    min(1000,my_maxmp());
       }
       if ((
    have_skill($skill[disco nap]) ||
            
    have_skill($skill[adventurer of leisure]) ||
            
    have_skill($skill[executive narcolepsy]) ||
            
    have_skill($skill[food coma]) ||
            
    have_skill($skill[dog tired]) ||
            
    get_property("chateauAvailable").to_boolean() ||
            
    have_familiar($familiar[unconscious collective])) && contains_text(visit_url("campground.php"),"_free.gif")) {  // free rest remains
          
    if (doitcli_execute("rest");
          return 
    min(restmp,my_maxmp());
       }
       return 
    0;
    }

    boolean burn_to(int target) {     // only returns true if burning occurred!
       
    target minmax(target,0,max(0,my_maxmp() - restmp));
       if (
    my_mp() <= target) return false;
       print(
    "Burning down to "+target+" MP...");
       
    int init my_mp();
       if (
    my_class() == $class[accordion thief]) record_songs();
       
    cli_execute("burn extra -"+target);
       if (
    my_mp() <= target) return true;
       
    int mpflag;
       
    repeat {
          
    mpflag my_mp();
          foreach 
    i,s in skills {
             if (
    6000 && 6028 && (have_effect(to_effect(s.nome)) == ||    // skip AT buffs you don't have or have too much of
                
    have_effect(to_effect(s.nome)) > 2000)) continue;
             if (!
    s.nome.song && max_castable(s.nome) > && my_mp() >= mp_cost(s.nome))
                
    use_skill(count(skills) == min(max_castable(s.nome),ceil((my_mp() - target)/mp_cost(s.nome))) : 1s.nome);
             if (
    my_mp() <= target) return true;
          }
       } 
    until (mpflag == my_mp());
       return (
    my_mp() != init);
    }

    boolean burn_everything() {
       if (
    my_path() == "Zombie Slayer") return true;
       if ((
    count(skills) > || have_item($item[the trickster trikitixa]) > 0) && next_restore(false) > 0) {
          
    maximize("-1000 mana cost, 2 mp, 1 hp",false);
    //      maximize("adv, switch disembodied hand, -tie",true);
          
    burn_to(min(numeric_modifier("_spec","Buffed MP Maximum"),my_maxmp()) - next_restore(false));
          while (
    next_restore(true) > && burn_to(my_maxmp() - next_restore(false))) {}
       }
       print(
    "No more free MP restores left.");
       
    maximize("adv, switch disembodied hand, -tie",false);
       if (
    count(skills) == 0) return true;
       return 
    burn_to(900000);

    Sig by JakAtk
    My scripts: Prefref Plus | One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | 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!

Posting Permissions

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