Page 3 of 25 FirstFirst 1 2 3 4 5 13 ... LastLast
Results 21 to 30 of 242

Thread: My personal Meat farming script

  1. #21
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,097

    Default

    Heh. My To Do list says:

    "Write note about combat filters taking round index (0 - x) rather than round number (1 - x)."

    We are not talking about consult scripts, except insofar as combat filters are an alternative approach.

    I think the original idea was that a combat filter would let you replace "line x" of a CCS - which is useless, since the combat filter has no idea of what the lines in the CCS section say.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

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

    Default

    I think the original idea was that a combat filter would let you replace "line x" of a CCS - which is useless, since the combat filter has no idea of what the lines in the CCS section say.
    Originally Posted by Veracity View Post
    Not entirely true: string get_ccs_action( int round )
    Last edited by Bale; 12-06-2016 at 09:01 AM.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  3. #23
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,097

    Default

    Ah. Except, that doesn't actually take a "round". It takes an "index".

    Code:
    	public static Value get_ccs_action( Interpreter interpreter, final Value index )
    	{
    		return new Value(
    			CombatActionManager.getCombatAction(
    				FightRequest.getCurrentKey(), (int) index.intValue(), true ) );
    	}
    The more I study it, the more I see that the whole CCS handling code really depends on line indices. I'm not sure I want to touch it.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  4. #24
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,713

    Default

    Yeah, which is actually why people complain about BCA pulling a specific line out of their CCS. Oh well. It is what it is.

  5. #25
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,097

    Default

    Time pranks:

    Code:
    static
    {
        string [int] PRANK_GREETINGS;
    
        void add_prank_greeting( string message )
        {
    	PRANK_GREETINGS[ count( PRANK_GREETINGS ) ] = message;
        }
    
        add_prank_greeting( "Booga booga!" );
        add_prank_greeting( "Tag! You're it!" );
        add_prank_greeting( "Didn't I just see you?" );
        add_prank_greeting( "Why are there so many %FRIEND%s in my timestream?" );
        add_prank_greeting( "Now that you have found me, I must kill you. Sorry." );
        add_prank_greeting( "Our tentacled masters demand I implant this tentacle in your head. Just hold still now..." );
    }
    
    void time_pranks( int minutes_left )
    {
        if ( minutes_left <= 0 ) {
    	return;
        }
    
        // load the set of prankees
        boolean [string] prankees;
        file_to_map( me + ".prankees.txt", prankees );
    
        int friends = count( prankees );
    
        string nth_friend( int n )
        {
    	if ( n >= 0 && n < count( prankees ) ) {
    	    foreach friend in prankees {
    		if ( n-- == 0 ) {
    		    return friend;
    		}
    	    }
    	}
    	return "";
        }
    
        int greetings = count( PRANK_GREETINGS );
    
        while ( minutes_left > 0 && friends > 0 ) {
    	// Pick a random friend
    	int n = friends == 1 ? 0 : random( friends );
    	string friend = nth_friend( n );
    	boolean enabled = remove prankees[ friend ];
    	friends--;
    
    	// You can enable/disable specific friends
    	if ( !enabled ) {
    	    continue;
    	}
    
    	string msg = PRANK_GREETINGS[ random( greetings ) ];
    	msg = replace_string( msg, "%FRIEND%", friend );
    
    	print( "Pranking " + friend + ": " + msg );
    	cli_execute("timespinner prank " + friend + " msg=" + msg);
    
    	minutes_left = 10 - get_property( "_timeSpinnerMinutesUsed" ).to_int();
        }
    }
    
    void time_pranks()
    {
        // Use up all remaining minutes pranking friends
        time_pranks( 10 - get_property( "_timeSpinnerMinutesUsed" ).to_int() );
    }
    Veracity.prankees.txt has lines like this:

    Code:
    Bale	true
    The boolean says whether this name is enabled or disabled.

    Revision 17490 exits the Time Prank choice if the prank failed.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  6. #26
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,268

    Default

    That's really nice. Now just to be perverse I'm going to throw this abomination at you...

    Code:
    for ( int n = friends-- == 1 ? 0 : random( friends ) , string friend = nth_friend( n ) , boolean enabled = remove prankees[ friend ], boolean enabled = remove prankees[ friend ] ;
       minutes_left > 0 && friends > 0 ; 
       n = friends-- == 1 ? 0 : random( friends ) , friend = nth_friend( n ) , boolean remove prankees[ friend ] , minutes_left = 10 - get_property( "_timeSpinnerMinutesUsed" ).to_int())

  7. #27
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,097

    Default

    I refuse to use that.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  8. #28
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,268

    Default

    I know, right? I've always assumed that's the reason ash didn't have java or c styled for loops. they're incredibly powerful, but capable of becoming so horrific in the wrong hands. I can't wait to see what zarqon gets up to with them, but I intend to be somewhat more careful since while I am fascinated with obfuscated code, I like to write code I can maintain.

    I could probably write some entire scripts tucked into one of those for loops with an empty loop

  9. #29
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,097

    Default

    Well, I figure that if people write code that even they can't maintain, that's their problem. One would hope that if they intend to share it, they will strive for clarity, though.

    All styles of loop have their place. Just because Java for loops can replace any of them (except for repeat until), doesn't mean that your code will be maintainable if you misuse them.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  10. #30
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,097

    Default

    I just updated the file on the initial post with the current version.

    It is heavily commented up top to describe how it uses each IOTM - although it works fine for accounts that don't have them, like most of my multis - and for everything that different characters might want to do differently, the "configuration" section lets you specify what to do.

    A lot of my previous "to do" list is done - the previously discussed Time Pranks, for example.

    Bug fixes. Lots of little things showed up over the last 10 days on one character or another. No issues in the last several, so, this release.

    Current to-do list:

    // ****** To Do **************
    //
    // Secondary buffbot for when primary is offline
    // When cheating deck, don't ask for unavailable cards
    // Allow five distinct Witchess combats
    // Better use of Dinsey foodcone and jumping horseradish
    // If clip art is unconfigured, choose most expensive item(s)?

    The first one is the only one that has bothered me; Testudinada has been off-line twice. The first time, so was Noblesse Oblige, so a backup buffbot would not have helped. The second time, N.O. was online. In both cases, restarting the script just picked up where it left off, and, Testudinada having come online, it worked fine.

    I only have one character who doesn't know Ode, otherwise, I might feel more motivation to finish that feature.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

Posting Permissions

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