Request: Banana farming script

Winterbay

Active member
I like bananas and the new Jackington fruitcloning machine makes it so that i can get more banans but it is a hassle to put a banana in the machine, adventure in the small world until I get the fruit choice, then go back and put another banana in and so on.

A script to do this would be great but I suck at decoding php code and thus I come here.

The machine is reached by the following command:
inv_use.php?whichitem=4560&place=tubes&pwd

Banana has the option number 2373 according to the source (which possible contain all needed information for the submit-button as well...)

Code:
<form action=inv_use.php method=post><input type=hidden name=action value=addfruit><input type=hidden name=pwd value=pwd-code><input type=hidden name=whichitem value=4560>Fruits: <select name=whichfruit><option value=0>(select a fruit)</option><option value=242>orange (267)</option><option value=243>grapefruit (116)</option><option value=244>grapes (56)</option><option value=245>olive (50)</option><option value=246>tomato (201)</option><option value=332>lemon (90)</option><option value=358>gr8ps (7)</option><option value=672>cranberries (232)</option><option value=786>strawberry (296)</option><option value=1558>tangerine (6)</option><option value=1560>cocktail onion (13)</option><option value=2373>banana (9)</option><option value=2579>cactus fruit (10)</option><option value=3558>sea lychee (2)</option><option value=3559>sea tangelo (2)</option><option value=3691>sea blueberry (3)</option><option value=3692>sea persimmon (4)</option><option value=4565>raisin (3)</option></select> <input class=button type=submit value="Insert Fruit!"></form>
 

Bale

Minion
Something like this then...

Code:
set_property("choiceAdventure452", "3");
while(my_adventures() > 0) {
   visit_url("inv_use.php?whichitem=2373&place=tubes&pwd");
   set_property("lastEncounter", "");
   while(my_adventures() > 0 && get_property("lastEncounter") != "Leave a Message and I'll Call You Back")
      adventure(1, $location[small-o-fier]);
}
 
Last edited:

Winterbay

Active member
Hmm... That seems to work so far as to adventure there and get the bananas from the net (if already in the machine), however it does not appear to put any bananas into it.
 

jasonharper

Developer
Actually, that line should be:
Code:
visit_url("inv_use.php?whichitem=4560&action=addfruit&pwd&whichfruit=" + to_int($item[banana]);

Go bananas!
 

Bale

Minion
This should fix it.

Code:
set_property("choiceAdventure452", "3");
while(my_adventures() > 0) {
   visit_url("inv_use.php?action=addfruit&pwd&whichitem=4560&whichfruit=2373");
   set_property("lastEncounter", "");
   while(my_adventures() > 0 && get_property("lastEncounter") != "Leave a Message and I'll Call You Back")
      adventure(1, $location[small-o-fier]);
}

Edit: Ninja'ed by Jason.
 

Bale

Minion
It is nice to know that the total number of bananas in the kingdom is no longer finite, even if bunches cannot be replicated.
 

snooty

Member
I'm definitely not a .ash guru, I tried using this today (thanks for the work Bale, and Jason), but it just keeps adventuring in the Small-O-Fier without putting a banana in the machine. What am I missing here?
 

Mr_Crac

Member
I'm definitely not a .ash guru, I tried using this today (thanks for the work Bale, and Jason), but it just keeps adventuring in the Small-O-Fier without putting a banana in the machine. What am I missing here?

I think this was nerfed (i.e. you can no longer create (bunches of) bananas this way), which is a bit silly, but what can you do.
 
Last edited:

slyz

Developer
Bale's code only puts bananas, not bunches of bananas.

Are you sure you aren't getting the bananas? There shouldn't be anything in the gCLI to indicate that bananas have been inserted.
Try with this slightly more verbose version:
PHP:
set_property("choiceAdventure452", "3");
string insertion;
while(my_adventures() > 0) {
   print("Inserting banana...","blue");
   insertion = visit_url("inv_use.php?action=addfruit&pwd&whichitem=4560&whichfruit=2373");
   if ( !contains_text(insertion, "The banana disappears into the tube") )
      abort("The banana didn't fit in the tube!");
   else print("Banana inserted, adventuring until fulfilled.","green");
   set_property("lastEncounter", "");
   while(my_adventures() > 0 && get_property("lastEncounter") != "Leave a Message and I'll Call You Back")
      adventure(1, $location[small-o-fier]);
}
 

snooty

Member
Thanks, slyz! That did the job. I was looking in session results for an increase in bananas which never appeared unless I stopped mafia and loaded the tube manually.
 

Fluxxdog

Active member
OK, got a tweaked version of this. A problem I had was if there was already a banana in there, it'd keep aborting, even if it was sucking a banana in and replacing another fruit. I also tweaked it so the "Hide behind a hair" option would be chosen for auto-adventuring.
PHP:
//Autoselects the "Escape" option to harvest bananas
set_property("choiceAdventure452", "3");
//Autoselects the "Hide behind a hair" option to gain some stats
//Change to 1 to fight a scabie or 3 to get hair of the calf
set_property("choiceAdventure453", "2");
string checktubes;
string insertion;
while(my_adventures() > 0) {
   print("Inserting banana...","blue");
   checktubes = visit_url("inv_use.php?whichitem=4560&place=tubes&pwd");
   if ( !contains_text(checktubes, "You can currently see a banana bouncing around inside the machine.") ) {
      insertion = visit_url("inv_use.php?action=addfruit&pwd&whichitem=4560&whichfruit=2373");
      if ( !contains_text(insertion, "The banana disappears into the tube") 
         && !contains_text(insertion, "The banana is sucked into the tube") ) 
           abort("The banana didn't fit in the tube!"); 
      else print("Banana inserted, adventuring until fulfilled.","green"); }
   else print("There's already a banana in there!","green"); 
   set_property("lastEncounter", "");
   while(my_adventures() > 0 && get_property("lastEncounter") != "Leave a Message and I'll Call You Back")
      adventure(1, $location[small-o-fier]);
}
Good script made better?
 

mellissaleo

New member
This is a question from a n00b in scripts and any usage of the CLI.

How could I limit the number of adventures this scrip is going to use? I think i remember seeing once that if I write `call nameofscript.ash 10` it would adventure 10 turns, or call the script 10 times. Or limit it in some way.
As it stands now, Fluxxdog`s version of this script keeps adventuring until I press escape.

The script helps me out a lot as it is and I wish to thank everybody that contributed to it :)
But if there is a way to limit the number of adventures it is going to use, I would greatly appreciate knowing it :)
 

Bale

Minion
Scripts are not CLI commands so that does not automatically work. However you can change the script to make that work. This will do the job:

PHP:
void main(int turns) {
   if(turns < 1)
      turns = my_adventures() + turns;
   //Autoselects the "Escape" option to harvest bananas 
   set_property("choiceAdventure452", "3"); 
   //Autoselects the "Hide behind a hair" option to gain some stats 
   //Change to 1 to fight a scabie or 3 to get hair of the calf 
   set_property("choiceAdventure453", "2"); 
   string checktubes; 
   string insertion; 
   while(my_adventures() > 0 && turns > 0) { 
      print("Inserting banana...","blue"); 
      checktubes = visit_url("inv_use.php?whichitem=4560&place=tubes&pwd"); 
      if ( !contains_text(checktubes, "You can currently see a banana bouncing around inside the machine.") ) {
         insertion = visit_url("inv_use.php?action=addfruit&pwd&whichitem=4560&whichfruit=2373"); 
         if ( !contains_text(insertion, "The banana disappears into the tube")  
           && !contains_text(insertion, "The banana is sucked into the tube") )  
            abort("The banana didn't fit in the tube!");  
         else print("Banana inserted, adventuring until fulfilled.","green"); 
      }
      else print("There's already a banana in there!","green");  
      set_property("lastEncounter", ""); 
      while(my_adventures() > 0 && turns > 0 && get_property("lastEncounter") != "Leave a Message and I'll Call You Back") {
         adventure(1, $location[small-o-fier]); 
         print("Turns left: "+turns, "olive");
      }
   }
}

If you want to use all of your turns, then give it a value of 0 for turns. If you want it to use all except for 10 of your turns, then -10 turns will suffice. That way it will work like a CLI command.
 
Your script will just run indefinitely since the turns counter is never reduced.
PHP:
void main(int turns) {
   if(turns < 1)
      turns = my_adventures() + turns;
   //Autoselects the "Escape" option to harvest bananas 
   set_property("choiceAdventure452", "3"); 
   //Autoselects the "Hide behind a hair" option to gain some stats 
   //Change to 1 to fight a scabie or 3 to get hair of the calf 
   set_property("choiceAdventure453", "2"); 
   string checktubes; 
   string insertion; 
   while(my_adventures() > 0 && turns > 0) { 
      print("Inserting banana...","blue"); 
      checktubes = visit_url("inv_use.php?whichitem=4560&place=tubes&pwd"); 
      if ( !contains_text(checktubes, "You can currently see a banana bouncing around inside the machine.") ) {
         insertion = visit_url("inv_use.php?action=addfruit&pwd&whichitem=4560&whichfruit=2373"); 
         if ( !contains_text(insertion, "The banana disappears into the tube")  
           && !contains_text(insertion, "The banana is sucked into the tube") )  
            abort("The banana didn't fit in the tube!");  
         else print("Banana inserted, adventuring until fulfilled.","green"); 
      }
      else print("There's already a banana in there!","green");  
      set_property("lastEncounter", ""); 
      while(my_adventures() > 0 && turns > 0 && get_property("lastEncounter") != "Leave a Message and I'll Call You Back") {
         adventure(1, $location[small-o-fier]); 
         turns = turns - 1; 
         print("Turns left: "+turns, "olive");
      }
   }
}

This should work.
 

mellissaleo

New member
That indeed works like a charm.

I would like to thank both of you, Bale and Misteryous Stranger, for the edits you did to the script to make it work :)
 
Top