Page 2 of 8 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 75

Thread: What's in your login/logout scripts?

  1. #11

    Default

    login (once a week):
    update store budget
    update BCC snapshot

    login (once-a-day):
    check for xmas pressie (and get it)
    buy raffle tickets
    get bounty

    every login:
    equip 'maximum item' outfit
    print how many lucre I have

    logout:
    for every item in display case, add in all spares from inventionry
    for each item in Mall Store, add all spares
    equip 'maximum adventure' outfit
    Attached Files

  2. #12
    Senior Member
    Join Date
    Jan 2010
    Posts
    692

    Default

    Ick. And it is made even harder by the fact that I've never seen mutex.ash. What does your login script do anyway?
    Originally Posted by Bale View Post
    mutex.ash is a very rudimentary mutex library. I have two scripts running simultaneously so I make sure they don't interfere with each other.
    This is the login script for a chat-based buffbot.
    I think that what you really want is this single line:
    PHP Code:
    camp_mp_gain numeric_modifier("Base Resting MP") * (numeric_modifier("Resting MP Percent")+100) / 100 numeric_modifier("Bonus Resting MP"); 
    Edit: I don't think that your old code will work anymore anyway. Dwellings were recently taken out of get_campground() and put into get_dwelling() so you need to fix that code.
    Originally Posted by Bale View Post
    Thank you! To be honest, I didn't write this chunk of the breakfast code, I worked on this script with a fellow clannie (though I'm not sure he wrote it himself either), and I never got around to re-writing it. Good to know that the dwellings won't work anymore, he'll have to update that (he recently took over all the botting duties, so it's his problem now)
    Thank you!

  3. #13
    Member
    Join Date
    Mar 2010
    Location
    Santa Clara, CA
    Posts
    92

    Default

    Thank you! To be honest, I didn't write this chunk of the breakfast code, I worked on this script with a fellow clannie (though I'm not sure he wrote it himself either), and I never got around to re-writing it. Good to know that the dwellings won't work anymore, he'll have to update that (he recently took over all the botting duties, so it's his problem now)
    Originally Posted by bordemstirs View Post
    That was all me - why do you think it's so inefficient? =D

    My script (which makes use of Bale's lovely bafh.ash):

    PHP Code:
    string start_outfit "Stat gains";

    boolean in_ronin()
    {
        if (!
    in_hardcore() && !can_interact())
            return 
    true;
        else
            return 
    false;
    }

    void rumpus()
    {
        
    string rumpus visit_url("clan_rumpus.php");
        print (
    "");
        print (
    "Visiting clan rumpus room.""blue");
        if (
    contains_text(rumpus,"rump3_3"))
        {
            print (
    "");
            print (
    "Accessing Mr. Klaw Skill Crane Game.""green");
            
    visit_url("clan_rumpus.php?action=click&spot=3&furni=3");
            
    visit_url("clan_rumpus.php?action=click&spot=3&furni=3");
            
    visit_url("clan_rumpus.php?action=click&spot=3&furni=3");
        }
        if (
    contains_text(rumpus,"rump3_1"))
        {
            print (
    "");
            print (
    "Using Soda Machine.""green");
            
    visit_url("clan_rumpus.php?action=click&spot=3&furni=1");
            
    visit_url("clan_rumpus.php?action=click&spot=3&furni=1");
            
    visit_url("clan_rumpus.php?action=click&spot=3&furni=1");
        }
        if (
    contains_text(rumpus,"rump1_4") || contains_text(rumpus,"rump4_2") || contains_text(rumpus,"rump9_3"))
        {
            print (
    "");
            print (
    "Picking meat from plants.""green");
            if (
    contains_text(rumpus,"rump1_4"))
                
    visit_url("clan_rumpus.php?action=click&spot=1&furni=4");
            if (
    contains_text(rumpus,"rump4_2"))
                
    visit_url("clan_rumpus.php?action=click&spot=4&furni=2");
            if (
    contains_text(rumpus,"rump9_3"))
                
    visit_url("clan_rumpus.php?action=click&spot=9&furni=3");
        }
        if (
    contains_text(rumpus,"rump9_2"))
        {
            print (
    "");
            print (
    "Getting chips.""green");
            for 
    i from 1 to 3
                visit_url
    ("clan_rumpus.php?preaction=buychips&whichbag="+i);
        }
        return;
    }

    void vip()
    {
        print (
    "");
        print (
    "Visiting VIP lounge.""blue");
        print (
    "");
        print (
    "Accessing Deluxe Mr. Klaw Skill Crane Game.""green");
        for 
    i from 1 to 3
            visit_url
    ("clan_viplounge.php?action=klaw");
        print (
    "");
        print (
    "Accessing A Looking Glass.""green");
        
    visit_url("clan_viplounge.php?action=lookingglass");
        
    set_property("crimboTreeDays",to_int(get_property("crimboTreeDays"))-1);
        
    void getTree()
        {
            print (
    "");
            print (
    "Grabbing Crimbo Tree gift.""green");
            
    cli_execute("clanhop bafh");
            
    visit_url("clan_viplounge.php?action=crimbotree");
            
    cli_execute("clanhop mesa");
        }
        if (
    get_property("crimboTreeDays") < 1)
        {
            if (
    user_confirm("Use Crimbo tree?"))
                
    getTree();
        }
        print(
    "");
        return;
    }

    void other()
    {
        print (
    "");
        print (
    "Finishing other breakfast functions.""blue");
        if (
    get_property("sidequestOrchardCompleted") != "none")
        {
            print (
    "");
            print (
    "Visiting the Hippy Store.""green");
            
    visit_url("store.php?whichstore=h");
        }
        foreach 
    item in $items[Manual of Transmission,Manual of Dexterity,Manual of Labor]
        {
        if (
    item_amount(item) == 1)
        {
            print(
    "");
            use(
    1,item);
        }
        }
        if (
    my_class() == $class[accordion thief])
        {
            
    visit_url ("volcanoisland.php?action=npc");
        if (
    item_amount($item[Fisherman's sack]) > 0)
            use(1,$item[Fisherman'
    s sack]);
        }
        if (
    item_amount($item[Cheap toaster]) > 0)
            use(
    3,$item[Cheap toaster]);
        if (
    item_amount($item[Burrowgrub hive]) > 0)
            use(
    1,$item[Burrowgrub hive]);
        if (
    item_amount($item[Chester's bag of candy]) > 0)
            use(1,$item[Chester'
    s bag of candy]);
        return;
    }

    void hardcore()
    {
        
    vip();
        
    other();
        return;
    }

    void ronin()
    {
        
    vip();
        
    other();
        return;
    }

    void aftercore()
    {
        
    rumpus();
        
    vip();
        
    other();
    //This uses daily skills with MP cost modifiers
        
        
    cli_execute("maximize -mana cost -tie");
        
    boolean dailyskills true;
        if ((
    my_class() == $class[sauceror]) && (item_amount($item[Gravyskin Belt of the Sauceblob]) > 0))
            if (!
    use_skill(3$skill["Advanced Saucecrafting"]))
                
    dailyskills false;
        if ((!
    use_skill(5$skill["Advanced Saucecrafting"])) || (!use_skill(5$skill["Pastamastery"])) || (!use_skill(5$skill["Advanced Cocktailcrafting"])) || (!use_skill(3$skill["Summon Sugar Sheets"])))
            
    dailyskills false;
        foreach 
    i in $items[twinkly wadhot wadcold wadstench wadspooky wadsleaze wad]
            
    buy(3,i);
        if (!
    use_skill(3,$skill["Rainbow Gravitation"]))
            
    dailyskills false;
        if (!
    dailyskills)
            
    user_confirm("Unable to cast all daily skills.");
        for 
    i from 1 to 5
            
    (!hermit(1$item[Ten-leaf clover]));
        
    cli_execute("clanhop mesa");

    //    outfit(start_outfit);
        
    return;
    }

    void main()
    {
    if (
    get_property("_breakfast") == "")
    {
        if (
    can_interact())
            
    aftercore();
        else if (
    in_hardcore())
            
    hardcore();
        else if (
    in_ronin())
            
    ronin();
        print (
    "");
        
    set_property("_breakfast""no");
        print (
    "");
        print (
    "Breakfast finished.""blue");
        print (
    "Opening relay browser...""green");
        
    cli_execute("relay");
    }
    else
    {
        print(
    "");
        print(
    "Breakfast already done today.""teal");
        print (
    "Opening relay browser...""green");
        print(
    "");
        
    cli_execute("relay");
    }

    Last edited by Sentrion; 12-11-2010 at 02:46 AM.

  4. #14
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,256

    Default

    Sentrion, most of what you list: Chester's bag, getting Fisherman's sack, cheap toasters, The Klaw, etc... That's all part of mafia's basic breakfast ability. Is there a reason to duplicate mafia's ability in the script instead of using breakfast?

    Stuff his scripts do
    Originally Posted by slyz View Post
    Other stuff that his scripts do
    Originally Posted by morgad View Post
    Thanks guys, these were some of what I was hoping for. You suggested a few things that I ought to put into my scripts.

    I'll have to add that free mining stuff, clanhopping and raffle ticket purchase stuff. Maybe some of the other things as well.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  5. #15
    Member
    Join Date
    Mar 2010
    Location
    Santa Clara, CA
    Posts
    92

    Default

    Yeah, I know breakfast does all of that, but I dunno...I just like having it all in one location for some reason.

  6. #16

    Default

    a couple of random comments -

    my ideas are a lot less buggy than the code that tries to implement them :-)

    If Mafia had seperate 'breakfast' (1st login after rollover) and 'login' scripts my code would be simpler

    If I could invoke mafia with --no-display --run-script foo.ash it would get rid all the java errors when firing mafia up once a week from a cron job
    (suspect I just neeed to re-direct errors to /dev/null instead)

    and of course this morning I suffered from major ISP problems as well :-( (no net since 3AM, full service due to resume tommorrow)

    Dave

  7. #17
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,395

    Default

    My login script doesn't do a lot -- mafia basically handles it all. A few things it does, most of which have already been mentioned:

    • Ensures that my battleAction is "custom combat script".
    • Puts on my "current" outfit.
    • Eats/drinks/uses any steel skill items.
    • For can_interact() characters, eats/drinks a standard menu, leaving room for estimated fortune cookie consumption. I have a provision for flagging character names as swimming, which makes the script eat/drink a seafaring menu.
    • Eats a fortune cookie if there is no active cookie counter.
    • Buys raffle tickets.
    • Opens the advent calendar for the day.
    • Gravitates the rainbow -- thanks Bale!
    • If (my_name() == "zarqon"), runs Registry.ash
    • If clear of restrictions, opens all gift packages.
    • Uses any scrolls of pasta summoning.
    • Admits any new clan member applicants.
    • Prints the author/time of the most recent clan forum post.
    • Whitelists, sends a message to, then boots any inactive members, so that they are not wasting clan resources for clan buffs.
    • Uses best_fam("items"), which also helps enforce 100% runs.


    My logout script is a bit more involved, particularly given the first item:

    • Builds a list of skills you can cast on yourself (ignoring buffs you already have a LOT of and AT buffs that you don't already have), then makes optimum use of any free restores (PYEC, Nuns, unused Disco rests) to buff you to the maximum, leaving you at my_mp() - rollover MP. Will also maximize MP before using any free restores. Thus, absolutely no MP is wasted.
    • Uses any unused still upgrades for the day (again, thanks Bale).
    • Uses meat containers (warm subject certificates, coin purses, etc.), small boxes, penultimate chests, -5 large boxes, and all briefcases (but it holds one back if you don't yet have pirate fledges).
    • Gets any un-got buffs (friars, ball pit, pool table, cocktail demon, stabonic scroll).
    • Sends certain various items to various collectors.
    • Closets all stuffies so they don't clutter inventory.
    • Closets excess meat.
    • For can_interact(), drinks a nightcap.
    • If the character is the clan treasurer, adds any meat stacks to the DC and updates the Fund information.
    • Runs my display case manager script (which generates my Bat King progress table).


    Not sure how much of that is useful to anyone, but I thought I would chip in.
    Sig by JakAtk
    My scripts: 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!

  8. #18
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    D.C. suburbs of Virginia, USA
    Posts
    3,701

    Default

    • Prints the author/time of the most recent clan forum post.
    • Whitelists, sends a message to, then boots any inactive members, so that they are not wasting clan resources for clan buffs.
    Originally Posted by zarqon View Post
    I'd add the first to my own scripts if you felt like posting the code.
    I don't understand the mechanic that allows for inactive members to waste resources. Is that because your clan has a bot that automagically buffs everyone in the clan?

    Thanks.
    You just vehemently agreed with me
    Originally Posted by Veracity View Post
    I agree with frono.
    Originally Posted by Veracity View Post
    There are 69 players more powerful than you.
    Originally Posted by Statistics Leaderboards

  9. #19

    Default

    I don't understand the mechanic that allows for inactive members to waste resources. Is that because your clan has a bot that automagically buffs everyone in the clan?

    Thanks.
    Originally Posted by fronobulax View Post
    There are things that can be used to give everyone outside of HC/ronin a buff, and you pay per person getting it. One of those things is an extra adventure for each person for 10k each. The workaround I've seen is a clan that only has a clan leader (in ronin) and a bunch of whitelists, so any buffs purchased only go to 1 person that wants it.

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

    Default

    Here are the relevant bits!

    PHP Code:
    string postplayer;

    // returns now as a unix timestamp
    int setnow() {
       
    string url visit_url("charpane.php");
       
    url substring(url,index_of(url,"rightnow = ")+11);
       return 
    to_int(substring(url,0,index_of(url,";")));
    }

    // returns the timestamp of the latest clan post
    int last_post() {
       
    int p,latest;
       
    string office visit_url("clan_forums.php");
       
    string[intchunks split_string(office,"echodate\\(");
       if (
    count(chunks) < 2) return 0;
       for 
    i from 1 to count(chunks)-{
          
    to_int(substring(chunks[i],0,index_of(chunks[i],",")));
          if (
    latest) {
             
    latest p;
             
    chunks[i] = substring(chunks[i],index_of(chunks[i],"who="));
             
    postplayer substring(chunks[i],index_of(chunks[i],">")+1,index_of(chunks[i],"</a>"));
          }
       }
       return 
    latest;
    }

    // converts a number of seconds into a fairly decent human-readable string
    string chunkit(int time) {
       
    int days floor(time / (3600*24)); time time - (days*3600*24);
       
    int hrs floor(time 3600); time time - (hrs*3600);
       
    int mins floor(time 60);
       
    buffer res;
       if (
    days 0res.append(to_string(days) +" days ");
       if (
    hrs 0res.append(to_string(hrs) +" hours ");
       if (
    mins 0res.append(to_string(mins) +" minutes ");
       if (
    res.length() == 0) return "less than a minute";
       return 
    res.to_string();
    }

    vprint("The last forum post was "+chunkit(setnow() - last_post())+" ago by "+postplayer+".",2); 
    Sig by JakAtk
    My scripts: 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!

Similar Threads

  1. Replies: 6
    Last Post: 01-24-2013, 09:53 PM
  2. Feature - Rejected Separate on-login/logout scripts per character
    By wrldwzrd89 in forum Bug Reports
    Replies: 4
    Last Post: 07-23-2012, 11:31 PM
  3. Replies: 14
    Last Post: 12-12-2011, 06:07 AM
  4. Replies: 0
    Last Post: 11-25-2011, 05:22 AM
  5. Logout Scripts
    By bumcheekcity in forum Scripting Discussion
    Replies: 7
    Last Post: 03-01-2010, 06:57 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
  •