Page 3 of 5 FirstFirst 1 2 3 4 5 LastLast
Results 21 to 30 of 45

Thread: Help with a script

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

    Default

    Here's what I was able to come up with. If there's an easier way to do it, I would be happy to change it. Criticism, good or bad, is always welcome.

    this is how my MP-Burning portion is called.
    PHP Code:
            set_property("autoManaRestore""false");        // this saves your meat
            
    mp_burner();
            
    set_property("autoManaRestore""true"); 
    PHP Code:
    void mp_burner()
    {
    int burn my_mp() * .85;
    string body;
    body visit_url ("campground.php");

        
    cli_execute("burn " burn " mana");
        if(
    get_property("nunsVisits") < && my_maxmp() * .85 my_mp()  ) // I figured having 15%, or less of your max MP was a good place to restore MP
            
    {
            
    visit_url("postwarisland.php?place=nunnery");
            
    visit_url("postwarisland.php?action=nuns&pwd&place=nunnery");
            
    cli_execute("burn " burn " mana");
            }
        if(
    get_property("expressCardUsed") == "false" && $item[Platinum Yendorian Express Card].available_amount() > && my_maxmp() * .85 my_mp() ) // I figured having 15%, or less of your max MP was a good place to restore MP
            
    {
            use(
    1$item[Platinum Yendorian Express Card]);
            
    cli_execute("burn " burn " mana");
            }
    int mpburn my_mp() * .50// I figured having 50% of your MP left was a good place for rollover
        
    if ($item[heart of dark chocolate].available_amount() > && get_property("_darkChocolateHeart") == "false" && my_maxmp() - my_mp() > 50)
            {
            use (
    1$item[heart of dark chocolate]);
            
    cli_execute("burn " mpburn " mana");
            }
        if(
    get_property("_eternalCarBatteryUsed") == "false" && $item[eternal Car Battery].available_amount() > && my_maxmp() - my_mp() > 50)
            {
            use(
    1$item[eternal Car Battery]);
            
    cli_execute("burn " mpburn " mana");
            }
        if(
    get_property("oscusSodaUsed") == "false" && $item[Oscus's neverending soda].available_amount() > 0 && my_maxmp() - my_mp() > 200 )
            {
            use(1, $item[Oscus'
    s neverending soda]);
            
    cli_execute("burn " mpburn " mana");
            }
        if(
    contains_text(body,"_free.gif") && my_maxmp() - my_mp() > 150)
            {
            
    cli_execute("rest");
            
    cli_execute("burn " mpburn " mana");
            }
            else 
    // when there's nothing left, this will fire off
                
    {
                
    cli_execute("burn " mpburn " mana");
                return;
                }
    mp_burner(); //this loops it back around to grab all free restorers until there are none left.

    I tried to figure out how to get the user set preference for MP, but I couldn't make it work, so I figured 50% of your MAX is pretty good.

    The full script is pretty user friendly, or as user friendly as I can make it. It includes a few new script related preferences, which will allow, or disallow options to be done. The MP-Burn is an option users can shut off.

    EDIT: I forgot about License to Chill, and April Shower (HOT) I'll have to script that in too

    EDITEDIT:
    Stealing these lines from Zarqon:
    if (numeric_modifier("Base Resting MP") < 40 && item_amount($item[Frobozz Real-Estate Company Instant House (TM)]) > 0 && use(1,$item[Frobozz Real-Estate Company Instant House (TM)])) {}
    if (numeric_modifier("Base Resting MP") < 10 && retrieve_item(1,$item[Newbiesport&trade; tent]) && use(1,$item[Newbiesport&trade; tent])) {}
    and making nun-restoring faster.
    Last edited by Pazleysox; 08-26-2017 at 01:40 AM.

  2. #22
    Senior Member AlbinoRhino's Avatar
    Join Date
    May 2008
    Posts
    727

    Default

    heart of dark chocolate is a HP restorer, isn't it ?

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

    Default

    heart of dark chocolate is a HP restorer, isn't it ?
    Originally Posted by AlbinoRhino View Post
    Mmm.. According to the wiki, you are correct. In my haste, I read it wrong. thanks for catching that!

  4. #24
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    264

    Default

    I found this nice little snippet on Bale's login script forum.

    I believe Bale is the one who wrote it

    PHP Code:
        {
        
    int tomeLeft 3get_property("tomeSummons").to_int();
        if (
    tomeLeft 1)
        print(
    "returned true");
            {
            
    item [intclip;
            for 
    i from 5224 to 5283
            clip
    [count(clip)] = i.to_item();
            
    sort clip by -mall_price(value);
            for 
    i from 0 to tomeLeft 
                
    {
                
    create(tomeleftclip[i]);
                print(
    "Sell "+clip[i]+" for "+mall_price(clip[i]), "blue");
                
    put_shop(mall_price(clip[i]), 0,  clip[i]);
                }
            }
        } 
    Here's the final result, after searching for all clip art
    Sell Temps Tempranillo for 8000
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0
    Sell none for 0

    If never creates the Temps Tempranillo though...

  5. #25
    Senior Member icon315's Avatar
    Join Date
    Nov 2009
    Location
    Kentucky
    Posts
    674

    Default

    Well you somehow seemed to have cut out part of the code, based on your curly braces there was something after 'print("returned true");'
    It was most likely a check to see if tomeleft is > 0. The reason it didn't create it is most likely because the input for create was 'create(0, Temps Tempranillo);' which it did. then it continued and put that 0 temps into the mall.

    Try this, should work (can't test it as i don't have the tome), i'm assuming this is a function within a script:
    PHP Code:
    boolean clipArt()
    {
        
    int tomeLeft 3get_property("tomeSummons").to_int();
        if (
    tomeLeft 1){    print("returned true"); return false;}
        
    item [intclip;
        for 
    i from 5224 to 5283
            clip
    [count(clip)] = i.to_item();
        
    sort clip by -mall_price(value);
        if(!
    create(tomeleftclip[0]) || tomeleft == 0)
        {
            print(
    "Failed to summon "+tomeleft+" "+clip[0]    );
            return 
    false;
            }
        else{
            print(
    "Sell "+clip[0]+" for "+mall_price(clip[0]), "blue");
            
    put_shop(mall_price(clip[0]), 0,  clip[0]);
        }
        return 
    true;

    I didn't understand the reasoning behind 'for i from 0 to tomeLeft - 1 '
    Last edited by icon315; 08-27-2017 at 12:26 AM.

  6. #26
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,764

    Default

    ...
    code with heretical indenting
    ...
    Originally Posted by Pazleysox View Post
    Code:
    if (tomeLeft > 1)
        print("returned true");
            {
    I bet that that print was not in the original code, because as it is, it is totally negating the point of the "if". You are printing "returned true" if tomeLeft > 1. And then, disirregardless of what tomeLeft >1 was, you continue with the inner block.

    Also, the for cycle probably does not do what you think it does when tomeLeft is zero (I also didn't know it behaves like this until I tried it):
    Code:
    > ash for i from 0 to -1 { print(i); }
    
    0
    -1
    Returned: void
    And, unsurisingly, clip[-1] == $item[none], because you never initialized negative indexes.

  7. #27
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,764

    Default

    I didn't understand the reasoning behind 'for i from 0 to tomeLeft - 1 '
    Originally Posted by icon315 View Post
    "If you have 3 tome summons left, don't create 3 of the most expensive thing, but 1 of the most expensive thing, 1 of the second most expensive thing, and 1 of the third most expensive thing". Spread you eggs across several baskets. Diversify your portfolio.

  8. #28
    Senior Member icon315's Avatar
    Join Date
    Nov 2009
    Location
    Kentucky
    Posts
    674

    Default

    "If you have 3 tome summons left, don't create 3 of the most expensive thing, but 1 of the most expensive thing, 1 of the second most expensive thing, and 1 of the third most expensive thing". Spread you eggs across several baskets. Diversify your portfolio.
    Originally Posted by xKiv View Post
    Well he'd use all his summons on the first loop:
    PHP Code:
    create(tomeleftclip[i]); 
    then on every loop from then on it would try to create 3 and fail. instead it should just be create(1,...)
    surprisingly this behaves differently than what i expected:
    Code:
    > ash for i from 1 to 3 { i--; print(i); }
    
    0
    1
    2
    Returned: void
    also i just looked up tomeSummons, not really sure what it checks (I'm assuming it checks all tomes and returns how many you've summoned all together) it returns 3 for me every time, even though i don't have clipart. I would use _clipartSummons instead. I guess you could check to see if you have clip art, but that seems unnecessary.
    So he can do:
    PHP Code:
        int tomeLeft 3get_property("_clipartSummons").to_int();
        if (
    tomeLeft 1)
            {
            
    item [intclip;
            for 
    i from 5224 to 5283
            clip
    [count(clip)] = i.to_item();
            
    sort clip by -mall_price(value);
            for 
    i from 1 to tomeLeft 
                
    {
                
    i--;
                
    create(1clip[i]);
                print(
    "Sell "+clip[i]+" for "+mall_price(clip[i]), "blue");
                
    put_shop(mall_price(clip[i]), 0,  clip[i]);
                }
            } 
    \

  9. #29

    Default

    If !can_interact() then all tome summons combined is limited to 3.

  10. #30
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    264

    Default

    PHP Code:
        int tomeLeft 3get_property("_clipartSummons").to_int();
        if (
    tomeLeft 1)
            {
            
    item [intclip;
            for 
    i from 5224 to 5283
            clip
    [count(clip)] = i.to_item();
            
    sort clip by -mall_price(value);
            for 
    i from 1 to tomeLeft 
                
    {
                
    i--;
                
    create(1clip[i]);
                print(
    "Sell "+clip[i]+" for "+mall_price(clip[i]), "blue");
                
    put_shop(mall_price(clip[i]), 0,  clip[i]);
                }
            } 
    Originally Posted by icon315 View Post
    Without manually looking at mall prices, I think this code worked perfect.

    Here's part of the final output:

    Sell Temps Tempranillo for 7992
    Adding Temps Tempranillo to store...
    4 Temps Tempranillo added to your store.
    Creating 1 thyme jelly donut...
    Casting Summon Clip Art 1 times...
    You acquire an item: thyme jelly donut
    Summon Clip Art was successfully cast.
    Successfully created thyme jelly donut (1)
    Sell thyme jelly donut for 7990
    Adding thyme jelly donut to store...
    1 thyme jelly donut added to your store.
    Creating 1 potion of the field gar...
    Casting Summon Clip Art 1 times...
    You acquire an item: potion of the field gar
    Summon Clip Art was successfully cast.
    Successfully created potion of the field gar (1)
    Sell potion of the field gar for 7990
    Adding potion of the field gar to store...

Posting Permissions

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