Page 2 of 23 FirstFirst 1 2 3 4 12 ... LastLast
Results 11 to 20 of 228

Thread: My personal Meat farming script

  1. #11
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,670

    Default

    Actually, now that I think of it, ghost zones are just adventure.php - so you always need that 1 turn simply because you never know what you will encounter. You might be expecting a free fight, but can meet a (newer?) turn-taking thing, teleportation, whatever.

  2. #12
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,011

    Default

    I worked on this all weekend and just uploaded a new version to the first post.

    - There is now a main() function which calls separate functions to do each "task". Bale might even approve.
    - There is a "configuration" section at the top.
    - There are now combat filters for busting ghosts, adventuring in the DMT, stasis with a Hobo Monkey, and a default
    - Summon mayflies at Barf Mountain to get more FunFunds.
    - Use free fights at witchess, snojo, and dmt
    - And I have a To Do list:

    // Get Witchess buff
    // bust_ghost_filter should not depend on Summon Love Gnats
    // Barrel Prayer for food if Turtle Tamer
    // Better use of Dinsey foodcone and jumping horseradish
    // When cheating deck, don't ask for unavailable cards
    // Secondary buffbot for when primary is offline
    // Better configuration of clip art, shower, Witchess
    // Use adventure() to go to next paranormal activity
    // Time-Spinner pranks?

    This is addicting.

    ----

    Issues with Combat Filters:

    - If a combat filter returns "item X", it tries to Funksling two of them. There is an open bug report discussing this and I, too, am not happy with the status quo.

    - If a combat filter returns "" with the intent that KoLmafia will continue in the CCS, that does, in fact, happen. However, it starts the CCS from the beginning. OK. It is not the case that a CCS has lines that correspond to "round 1" "round 2" and so on, such that you could skip to the current round, so, it really has to do that.

    But this does mean that your CCS needs to be able to start at the beginning even in the middle of a fight. KoLmafia will turn your CCS into a macro and submit it, and it will not macrofy skills that are not currently available, I believe, but for some reason it will macrofy "steal" even if you already stole this combat. It is, sometimes, possible to steal twice (DB with the Bling of the New Wave, for example), but our way of detecting whether you can still steal is to look at the text of the fight page and see if it offers you the chance.

    Perhaps the Macrofier should do that too.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  3. #13
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,256

    Default

    I do approve actually. I like doing that, even if it is just so that I can easily comment out functions that I don't currently want and still find them later. It really is all around nicer.

    One question: You do know that you can static {lots of declarations} instead of having to put static in front of every declaration, right? I mean, I know you created it, but I wonder if you remember that fact. Do you just like the way it looks to have each static variable individually declared that way?

    PS. Since you have timepranks on your list, I do it something like this...
    Code:
    	if(get_property("kingLiberated").to_boolean() && available_amount($item[Time-Spinner]) > 0) {
    		int pranks() { return 10 - get_property("_timeSpinnerMinutesUsed").to_int() - (get_property("_timeSpinnerReplicatorUsed").to_boolean()? 0: 2);}
    		if(pranks() > 0) {
    			print("Pranks remaining: "+pranks());
    			foreach friend in $strings[Veracity, hardcoded list deleted for privacy]
    				if(pranks() > 0) {
    					string msg;
    					switch(random(5)) {
    					case 0: msg = "Why are there so many "+friend+"s in my timestream?"; break;
    					case 1: msg = "Tag! You're it!"; break;
    					case 2: msg = "Ha, ha! I have stolen your nose."; break;
    					case 3: msg = "Nothing personal, but I must kill you before you go back in time to kill Hitler or else all causalty in this Universe may be destroyed!"; break;
    					case 4: msg = "Our tentacled masters demand I implant this tentacle in your head. Just hold still now..."; break;
    					}
    					print("Pranking "+friend+": "+msg);
    					cli_execute("timespinner prank " + friend + " msg=" + msg);
    					string temp = visit_url("choice.php?pwd&whichchoice=1198&option=2"); // Clear the choice in case the timestream was clogged.
    				}
    		}
    	}
    I considered adding to my list with who_clan(), but a hardcoded list suits me better.

  4. #14
    Senior Member
    Join Date
    Apr 2009
    Posts
    1,670

    Default

    But this does mean that your CCS needs to be able to start at the beginning even in the middle of a fight. KoLmafia will turn your CCS into a macro and submit it, and it will not macrofy skills that are not currently available, I believe, but for some reason it will macrofy "steal" even if you already stole this combat. It is, sometimes, possible to steal twice (DB with the Bling of the New Wave, for example), but our way of detecting whether you can still steal is to look at the text of the fight page and see if it offers you the chance.

    Perhaps the Macrofier should do that too.
    Originally Posted by Veracity View Post
    CCS needs to be able to start properly in the middle of a fight anyway. I can start a fight in relay browser, do a few rounds, then press the AUTO (or is it SCRIPT?) button.
    I can also have an /autoattack that doesn't finish the fight, after which mafia's ccs can take over.

    I am also pretty sure that specifically macrofied pickpocket has been fixed way ago (kol side) to not trigger monster attack when useless. It will say you can't pickpocket anything, but not waste an action. At least that's how it seems to work in the native macros that I use all the time. I don't even think it advances the round counter, but I am not nearly 100% confident on that.

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

    Default

    Yes, it works KoL side. And it does not advance the round counter. The presence of "It is round 4 but KoL thinks it is round 3" messages in the gCLI is what alerted me to this.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  6. #16
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,011

    Default

    One question: You do know that you can static {lots of declarations} instead of having to put static in front of every declaration, right? I mean, I know you created it, but I wonder if you remember that fact. Do you just like the way it looks to have each static variable individually declared that way?
    Originally Posted by Bale View Post
    I do know that. It's a matter of indentation: when you "static {}", it looks like the {} is a block - although it isn't, really - and my editor wants to indent the enclosed declarations. To my eye, that is unclear: you CAN declare variables in a block, and their scope is that block - but for static{}, the scope is actually not restricted. It's just a way of grouping declarations, just as we can do the same thing with cli_execute {}.

    I did implement it, but I don't like using it. Maybe I just need to fix my editor.

    Another "style" thing: I think I will capitalize the names of constants, just as I do in Java, to make it clear they are not regular variables.

    PS. Since you have timepranks on your list, I do it something like this...

    ... code...

    I considered adding to my list with who_clan(), but a hardcoded list suits me better.
    Thanks! I'll look at it and use some of it, I am sure.

    I want to do pranks because this is an aftercore script and I have lots of extra Time-Spinner minutes.

    Also on my list is looking again at the "timespinner" command and making sure that if a prank fails, it tells you, and leaves you out of the choice.

    In any case, one of the goals of this weekend's work was to let you (me) run it having done (whatever) first - start it, abort it, restart it, for example. Several of the items on the "To Do" list are more of the same - checking deck cards, for example.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  7. #17
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,256

    Default

    Thanks for indulging my curiosity on that cosmetic issue.


    Also on my list is looking again at the "timespinner" command and making sure that if a prank fails, it tells you, and leaves you out of the choice.
    Originally Posted by Veracity View Post
    Yeah. I've got a line in that code specifically to exit the choice after a failed prank. Which now that I think about it, I should have placed outside of that loop.


    Several of the items on the "To Do" list are more of the same - checking deck cards, for example.
    My aftercore cheating code:

    Code:
    	if(available_amount($item[Deck of Every Card]) > 0) {
    		string [int] cards;
    		if(hippy_stone_broken())
    			cards[ count(cards) ] = "X of Clubs";
    		foreach card in $strings[Island, Ancestral Recall, 1952 Mickey Mantle]
    			cards[ count(cards) ] = card;
    		foreach x,card in cards
    			if(get_property("_deckCardsDrawn").to_int() < 11 && !get_property("_deckCardsSeen").contains_text(card))
    				cli_execute("cheat " + card);
    	}
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  8. #18
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,011

    Default

    I can also have an /autoattack that doesn't finish the fight, after which mafia's ccs can take over.
    Originally Posted by xKiv View Post
    Yes, and there is funky code in FightRequest.updateCombatData:

    Code:
    		// We've started a new round
    		++FightRequest.currentRound;
    
    		// Sanity check: compare our round with what KoL claims it is
    		Matcher m = ONTURN_PATTERN.matcher( responseText );
    		if ( m.find() )
    		{
    			int round = StringUtilities.parseInt( m.group(1) );
    			if ( round != FightRequest.currentRound )
    			{
    				RequestLogger.printLine( "KoLmafia thinks it is round " + FightRequest.currentRound + " but KoL thinks it is round " + round );
    			}
    		}
    
    		// *** This doesn't seem right, but is currently necessary for
    		// *** CCS scripts to behave correctly. FIX
    		if ( autoAttacked )
    		{
    			++FightRequest.preparatoryRounds;
    			++FightRequest.currentRound;
    		}
    Considering that I want to add a line following the "KoLmafia thinks it is round x" message:

    Code:
    			// Synchronize with KoL
    			FightRequest.currentRound = round;
    in order to show the line ONCE - which is useful for spading, actually, in that it tells you that you just did something which did not actually advance the round number. But seeing it for all the rest of the rounds in the fight is not useful.

    I will investigate exactly what autoattack does to the round number and see if I can "FIX" this.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

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

    Default

    Revision 17473 fixes the "off by one" round reporting.

    Well, if you "steal" in the Relay Browser and then say "script" it will start your CCS - and if the first action of that is "steal", it will submit it again. In which case, we'll see the "off by one" message, but will reset our round counter to agree with KoL, and everything thereafter will be fine.

    I tried with an autoattack of "steal" and - with another adjustment, it works fine.

    I did notice:

    consult scripts take a "round #" - which starts at 1 and goes up.
    combat filters want a "round index" - which starts at 0 and goes up.

    So, that is not actually the same as a consult script, regardless of documentation.

    I can change combat filters to agree with consult scripts - which will break them all - or leave it as is.

    Thoughts?
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  10. #20
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,256

    Default

    My first thought is that it is too important a question to be kept in an thread without a relevant title to draw everyone's eye. This is a thread about how Veracity does some daily automation. Not everyone who is invested in combat scripting will read it.

    My second thought is that you shouldn't break consult scripts. Breaking combat filters to make them work as reported is probably for the best since consistency is also important and pretty much all you'll break is bumcheekascend.
    Last edited by Bale; 12-06-2016 at 05:14 AM.

Posting Permissions

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