Difference between revisions of "Cli execute"

From Kolmafia
Jump to navigation Jump to search
imported>MapleMario
imported>Alphacow
(group together many cli_execute commands)
Line 35: Line 35:
 
       cli_execute("cast 35 polka of plenty");
 
       cli_execute("cast 35 polka of plenty");
 
     }
 
     }
 +
</pre>
 +
 +
Note that you can speed things up (and possibly reduce the number of HTTP requests sent to KoL) by combining multiple requests in one command:
 +
<pre>
 +
    # from bottom of above code...
 +
    if (switch_ode_polka)
 +
    {
 +
      cli_execute{
 +
        uneffect ode to booze;
 +
        nuns;
 +
        cast 35 polka of plenty;
 +
      } # note the lack of a semicolon here!
 +
    }
 +
 
</pre>
 
</pre>

Revision as of 16:10, 11 February 2010

boolean cli_execute( string command ) Executes the given command as a CLI command, rather than ASH.

// snippet from my aftercore.ash script
    cli_execute("outfit "+consumption_outfit);
    
    if (use_milk_of_mag) cli_execute("use milk of magnesium");
    
    foreach i in food_items
    {
    
      cli_execute("eat "+food_items[i]);
    
    }
    
    foreach i in booze_items
    {
    
      cli_execute("drink "+booze_items[i]);
    
    }
    
    foreach i in spleen_items
    {
    
      cli_execute("use "+spleen_items[i]);
    
    }
    
    if (switch_ode_polka)
    {
      cli_execute("uneffect ode to booze");
      cli_execute("nuns");
      cli_execute("cast 35 polka of plenty");
    }

Note that you can speed things up (and possibly reduce the number of HTTP requests sent to KoL) by combining multiple requests in one command:

    # from bottom of above code...
    if (switch_ode_polka)
    {
      cli_execute{
         uneffect ode to booze;
         nuns;
         cast 35 polka of plenty;
      } # note the lack of a semicolon here!
    }