Results 1 to 7 of 7

Thread: TimeSpinner functions

  1. #1
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    630

    Default TimeSpinner functions

    In case anyone needs to script TimeSpinner use (before it is implemented natively), I wrote a few functions you may find useful.

    PHP Code:
    //Fight a monster based on ID #
    boolean TimeFight(int mid) {
        
    monster mon to_monster(mid);
        print(
    "TimeFighting a "+mon,"maroon");
        
    buffer page visit_url("inv_use.php?pwd=&whichitem=9104");
        if (
    get_property("_timeSpinnerMinutesUsed").to_int()>7) {
            print(
    "TimeFighting failed, not enough minutes","red");
            return 
    false;
        }
        
    page run_choice(1);
        if (
    contains_text(page,"option value=\""+mid+"\"")) {
            
    //print("TimeFighting "+mon,"blue");
            
    page visit_url("choice.php?pwd=&whichchoice=1196&option=1&monid="+mid);
            
    page run_combat();
            return 
    true;
        } else {
            print(
    "TimeFighting failed, "+mon+" not available","red");
            return 
    false;
        }
    }

    //Fight a $monster[]
    boolean TimeFight(monster mon) {
        return 
    TimeFight(to_int(mon.id));
    }

    //Eat a remembered food
    boolean TimeEat(item fud) {
        
    int iid to_int(fud);
        
    buffer page visit_url("inv_use.php?pwd=&whichitem=9104");
        if (
    get_property("_timeSpinnerMinutesUsed").to_int()>7) {
            print(
    "TimeEating failed, not enough minutes","red");
            return 
    false;
        }
        
    page run_choice(2);
        if (
    contains_text(page,"option value=\""+iid+"\"")) {
            print(
    "TimeEating "+fud,"blue");
            
    page visit_url("choice.php?pwd=&whichchoice=1197&option=1&foodid="+iid);
            return 
    true;
        } else {
            print(
    "TimeEating failed, "+fud+" not available","red");
            return 
    false;
        }
    }

    //Fight a scaling back in time monster
    boolean TimePower() {
        
    buffer page visit_url("inv_use.php?pwd=&whichitem=9104");
        if (
    get_property("_timeSpinnerMinutesUsed").to_int()>9) {
            print(
    "TimePower failed, not enough minutes","red");
            return 
    false;
        }
        print(
    "TimePower leveling","maroon");
        
    page run_choice(3);
        
    run_combat();
        if (
    item_amount($item[compounded experience])>0) {
            return 
    true;
        } else {
            print(
    "TimePower failed","red");
            return 
    false;
        }


  2. #2
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    12,968

    Default

    Thank you for sharing. I am learning to dislike using the time-spinner without CLI commands, particularly for eating food.

  3. #3

    Default

    If you're going to check for the food being valid, you can check _timeSpinnerFoodAvailable before loading the page.

    I've already failed at figuring out how to get that working as a built-in mafia command, hopefully someone else can tackle it.

  4. #4
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    10,532

    Default

    I'll take a look at what you posted, again. Didn't see anything obvious the first time.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

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

    Default

    If you're going to check for the food being valid, you can check _timeSpinnerFoodAvailable before loading the page.
    I've already failed at figuring out how to get that working as a built-in mafia command, hopefully someone else can tackle it.
    Originally Posted by lostcalpolydude View Post
    I could do that, but there seems to be some issue where _timeSpinnerMinutesUsed gets out of sync with actual minutes used, and hitting the page will refresh and get the correct value. And while I am hitting that page, it is easy to look at the food list too.

    So this is a long-winded way of me remembering I should file a bug report about that and trying to figure out when it happens.

  6. #6
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    10,532

    Default

    Do you still need to file a bug report?
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  7. #7
    Senior Member ckb's Avatar
    Join Date
    Mar 2006
    Posts
    630

    Default

    Do you still need to file a bug report?
    Originally Posted by Veracity View Post
    I don't know. I've been automating my runs and not paying much attention to "_timeSpinnerMinutesUsed", but this reminds me to add some additional checks for next time.

Posting Permissions

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