Results 1 to 4 of 4

Thread: Store advertising...

  1. #1
    Senior Member
    Join Date
    Mar 2009
    Posts
    650

    Default Store advertising...

    Is there a CLI command to add to store advertising? I didn't see anything in mafia's store manager utility. Just thought I'd ask

    -Spiny

  2. #2
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,287

    Default

    As far as I know, there is not. Though there should be. I'd recommend:

    Code:
    int x = 1000; // Add 1000 to advertising budget. 
    visit_url("managestore.php?howmuch="+x+"&advertising=Add+to+Budget&action=addad&pwd");
    parsing the current budget so that you can automate it... Let's see...

    Code:
    int current_budget;
    string store = visit_url("managestore.php");
    matcher budget = create_matcher("Current Budget: (\\d+) Meat" , store);
    if(budget.find()) current_budget = budget.group(1);
    	else abort("Advertising Budget Unknown!");
    print("Current Advertising Budget: "+current_budget);
    
    int x = 1000 - current_budget; 
    if(x > 0)
    	visit_url("managestore.php?howmuch="+x+"&advertising=Add+to+Budget&action=addad&pwd");
    Please note that the above code is 100% untested. I just pulled that off the top of my head so please troubleshoot it properly before trusting it.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


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

    Default

    This is the function that I have in my Treasurer-bot's routine script. It will check to see that your store's ad budget is set to target, and if not will add the required amount of meat to bring it back up to target. It is tested working, but note that it uses a function from ZLib.

    Code:
    void handle_store_budget(int target) {
       string bp = excise(visit_url("managestore.php"),"Current Budget: ","<br");
       if (bp == "") {
          print("Error detecting store advertising budget.","red");
          return;
       }
       int currbudg = to_int(bp);
       print("Store advertising budget: "+currbudg);
       boolean increase_ad_budget(int amt) {
          print("Adding "+amt+" meat to ad budget...");
          return contains_text(visit_url("managestore.php?howmuch="+amt+"&action=addad&pwd"),"Advertising budget increased.");
       }
       if (currbudg < target && increase_ad_budget(target - currbudg))
          print("Budget increased to "+target+".");
    }
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  4. #4
    Senior Member
    Join Date
    Mar 2009
    Posts
    650

    Default

    Thanks you two I went with Zarqon's version because it was pre-tested. Already have zlib.ash and my friend added a little pop-up box for me to plug in my target budget and some verboseness for when I screw up and forget lol.

    -Spiny

Similar Threads

  1. Feature - Rejected Mafia ignores advertising
    By Smiling Spectre in forum Bug Reports
    Replies: 6
    Last Post: 09-06-2013, 07:39 PM
  2. Does Mafia ignore advertising? Should it?
    By Sarmatron in forum Community Support
    Replies: 8
    Last Post: 10-22-2012, 05:12 AM
  3. Replies: 2
    Last Post: 01-23-2012, 11:57 PM
  4. Can you check Mall advertising budget?
    By morgad in forum Informational Scripts
    Replies: 2
    Last Post: 02-21-2010, 05:52 PM
  5. Link back to manage store at the top of the store log page
    By efilnikufecin in forum Relay Override Scripts
    Replies: 0
    Last Post: 01-02-2008, 03:18 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
  •