Results 1 to 9 of 9

Thread: Rollover MP

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

    Default Rollover MP

    In trying to update the rollover script that I found, this snippet of code is preexisting. I want to update the script as much as I can. I think I understand what this is doing, but I don't know how to figure out which dwelling = which #... There's a ton of new "houses" since this script was written.

    PHP Code:
        string body;
        
    body visit_url("/campground.php");
        
    int rollMP;
        
    int ind index_of(body,"campground/rest")+15;
        
    int house to_int(substring(body,ind,ind+1));
        if (
    house == 0
            {    
    print_html("You will get no <font color=FF0000>Rollover MP</font> without a Campground dwelling - you can buy a tent");  }
                else {
                
    rollMP house 10;
                if (
    house == 7
                { 
    rollMP 85; }
                else if (
    house == 8
                { 
    rollMP 70; }
                else if (
    house == 9)
                { 
    rollMP 35; }
                     } 
    Can anyone shine some light on how to find house #'s?

  2. #2

    Default

    It's the URL for the image used for your house. That code won't work any more though, since some housing has 2-digit numbers and that code only looks at the first digit.

  3. #3
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    256

    Default

    It's the URL for the image used for your house. That code won't work any more though, since some housing has 2-digit numbers and that code only looks at the first digit.
    Originally Posted by lostcalpolydude View Post
    Is there a way to get the script to look at multiple numbers?
    IE:
    PHP Code:
                rollMP 85; }
                else if (
    house == 15
                { 
    rollMP 70; }
                else if (
    house == 16)
                { 
    rollMP 35; } 
    Or will this still only look at the first number?

  4. #4

    Default

    Unless you're asking someone to hand you some code, you'll need to read and understand lines 4 and 5 of the script, and likely replace them with some regex.

  5. #5
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    256

    Default

    Unless you're asking someone to hand you some code, you'll need to read and understand lines 4 and 5 of the script, and likely replace them with some regex.
    Originally Posted by lostcalpolydude View Post
    Thanks for the tip! I'll look into this further.

  6. #6

  7. #7

    Default

    Code:
    numeric_modifier( get_dwelling(), "Base Resting MP" )
    looks like it would work. So you'll be throwing away the entire code block you were starting from.

  8. #8
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,483

    Default

    Yep. My logout script has this for resting MP:

    Code:
    numeric_modifier("Base Resting MP") * (100+numeric_modifier("Resting MP Percent"))/100 + numeric_modifier("Bonus Resting MP")
    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!

  9. #9
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    256

    Default

    Here's what I came up with
    PHP Code:
    string body;
    float bart;
    body visit_url("/campground.php?action=inspectkitchen");
    boolean [stringnumeric_modifier;
    numeric_modifier"Base Resting MP" ] = true;
        {
        foreach 
    name in numeric_modifier
        
    {
        if (
    contains_text(body,"bartinbox.gif")) 
            {        
    bart bart 15;            }
                else
            {        
    bart bart 0;        }
            
    float mod numeric_modifiername );
            
    float mymod = (my_mp() + mod my_maxmp() + bart);
                if ( 
    mod bart my_MP() > my_maxmp() )
        {print (
    "You stand to loose " +mymod" MP at rollover, I suggest burning some");}
        else{ print(
    "You will not loose MP");}
        }}} 
    This works really well. It will give players a print out showing how much MP will be lost at rollover (if any)

    I ended up going back to this thread: http://kolmafia.us/showthread.php?802 to help with finding my answer.
    Last edited by Pazleysox; 08-08-2017 at 02:24 PM. Reason: added bartender check

Posting Permissions

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