TH Greasemonkey thread 2.0

Talk about the game. What game? The game with the power? What power? The power of ... aw, skip it.

Moderator: Moderators

User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

I was wondering if someone could add "Summon Fortune Cookie" to the existing script that batch-uses *ouch items.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
seventhcross
Posts: 107
Joined: Thu Nov 13, 2008 11:54 am
Contact:

Re: TH Greasemonkey thread 2.0

Post by seventhcross »

Using the new Zillow improved auto-adventure script, I'm trying to code in a use ecto item, then star option.

Problem: each ecto item has a different item number. So when I plug them all in, it willl try to use each one, in order and if I don't have the item, it defaults to attack. Is there a way to get it coded so that it will just skip the item and move on to the next one in the list instead of switching to attack?
Image
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

I asked the same thing. Zillow said he'd have to adjust the coding when he has time.

Oddly enough, that was one of the good things Heather's old script would do. If you had it coded to use an item you didn't have, it would just bring up the "you're trying to use an item you don't have screen" and move on to the next.
xKiv
Posts: 162
Joined: Sat Jan 01, 2011 1:40 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by xKiv »

I changed the code for 'I' action to

Code: Select all

      nextButton=find('.//input[@type="submit" and contains(@value,"Item")]');
      var ffound = false;
      for (var fidx = 1; fidx < selectedAction.length && !ffound; fidx++)
      {
      	if (Select_Value_Set_Name('pickwhich',qqq-1,selectedAction[fidx]))
	{
		ffound = true;
	}
      }
      if(!ffound)
      {
        nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');
      }
and then the action is 'I:1766:1767:1768:1769:1770'

I also tried to add in an action to 'Q'uit (stop autoattacking, basically by calling shutDown()), but most of the time, one attack still gets through for some reason.
seventhcross
Posts: 107
Joined: Thu Nov 13, 2008 11:54 am
Contact:

Re: TH Greasemonkey thread 2.0

Post by seventhcross »

Thanks Kiv! that totally fixed my issues!
Image
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

Where the heck do we put that code in? I'm not seeing the 'I' function anywhere.
xKiv
Posts: 162
Joined: Sat Jan 01, 2011 1:40 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by xKiv »

It's not a function. It's where the current action (selectedAction[0]) is compared to the string 'I' (that's capital i), near the end of getNextButton.
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

That didn't work for me at all. It still tries to attack when it's looking for an item that is not in my inventory.
xKiv
Posts: 162
Joined: Sat Jan 01, 2011 1:40 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by xKiv »

Did you also change your action (to I:1766:1767:1768:1769:1770)?
You *do* have one of the ecto items in your invetory, right?
And you are only trying to use it *once* per combat?
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

Yes, I have an ecto-item. I added the item numbers to the strategy I use, so that it listed all 5 ecto-items and then my throwing stars, and then finally attacking.
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

Okay, I got it to work. If you're still confused:

Scroll down past all your stratlists and your noncom choices. You'll see a lot of code, one that should pop out is:

Code: Select all

nextButton=find('.//input[@type="submit" and contains(@value,"Tame the Animal")]');
Go a few lines past that until you see:

Code: Select all

nextButton=find('.//input[@type="submit" and contains(@value,"Item")]');
      if(!Select_Value_Set_Name('pickwhich',qqq-1,selectedAction[1]))
      {
        nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');
      }
    }
  }
  return nextButton;
Highlight xKiv's code down to the curly bracket right before the "@value,"Attack"" line, and paste it in. It should look like this when you're done:

Code: Select all

nextButton=find('.//input[@type="submit" and contains(@value,"Item")]');
      var ffound = false;
      for (var fidx = 1; fidx < selectedAction.length && !ffound; fidx++)
      {
         if (Select_Value_Set_Name('pickwhich',qqq-1,selectedAction[fidx]))
   {
      ffound = true;
   }
      }
      if(!ffound)
      {
        nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');
      }
    }
  }
  return nextButton;
Then, scroll up to the stratList lines to plug in your ecto usage. For mine, I have:

Code: Select all

stratList['Ecto, Star, then Attack To Death'] = 'I:1766:1767:1768:1769:1770:I:881;I:882:A'; //BH, Mag, attack
Works great.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

Once I change the "Item" code, the stupid console for the script disappears from the page and I have to switch it back to the normal code for the script to be usable again.
xKiv
Posts: 162
Joined: Sat Jan 01, 2011 1:40 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by xKiv »

Harry Dresden wrote:Once I change the "Item" code, the stupid console for the script disappears from the page and I have to switch it back to the normal code for the script to be usable again.
You are introducing a syntax error somewhere, probably by ending the cut/paste at the wrong curly brace.

Larger code sample - this is how it looks in my version; at least the first line and 5 last lines (from return nextButton) should be exatly the same as in the original (this means that the last } is the first thing on its line!):

Code: Select all

    } else if(selectedAction[0]=='I')
    {
      nextButton=find('.//input[@type="submit" and contains(@value,"Item")]');
      var ffound = false;
      for (var fidx = 1; fidx < selectedAction.length && !ffound; fidx++)
      {
      	if (Select_Value_Set_Name('pickwhich',qqq-1,selectedAction[fidx]))
	{
		ffound = true;
	}
      }
      if(!ffound)
      {
        nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');
      }
    } else if (selectedAction[0]=='Q')
    {
      return null;
    }
  }
  return nextButton;
}

function Select_Value_Set(SelectName, Value)
{
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

huh....I could have sworn I was making sure all the syntax was right. It's working now, though, so thanks!
zillow
Posts: 191
Joined: Thu Sep 04, 2008 5:33 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by zillow »

There's a small error with combat in the AA script when it sometimes tries to do an option twice. To fix it, at around line 310 you find: round=((round<=0)?0:round);
replace it with:
if(round < 0)
{
GM_setValue('roundNumber', 0);
round = 0;
}
Image
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

So, in context, it should look like this?

Code: Select all

var round =(GM_getValue('roundNumber', 0)>=strategy.length?strategy.length-1:GM_getValue('roundNumber', 0));
    //--round;
    if(round < 0)
{
GM_setValue('roundNumber', 0);
round=0;
}
    GM_log(round);
    var selectedAction = strategy[round].split(':');
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
zillow
Posts: 191
Joined: Thu Sep 04, 2008 5:33 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by zillow »

Yep :)
Image
User avatar
Corrupt Shadow
Posts: 1234
Joined: Mon Dec 17, 2007 8:24 pm
Location: Baton Rouge, LA
Contact:

Re: TH Greasemonkey thread 2.0

Post by Corrupt Shadow »

I updated my AA script and Greasemonkey in an effort to get it fixed, and I lost my portion of the code for an attack strategy of "Firestorm to Death".

Can anyone help me out and tell me what code to put and where to put it?

Thanks in advance!
Image
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
User avatar
Corrupt Shadow
Posts: 1234
Joined: Mon Dec 17, 2007 8:24 pm
Location: Baton Rouge, LA
Contact:

Re: TH Greasemonkey thread 2.0

Post by Corrupt Shadow »

That's it, mara! Thanks!
Image
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
User avatar
Isladar
Posts: 64
Joined: Wed Dec 29, 2010 4:10 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Isladar »

Does anyone have an updated version of the Batch use *ouch items script that includes Professor Ouch's Satchel?
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: TH Greasemonkey thread 2.0

Post by Satan »

Isladar wrote:Does anyone have an updated version of the Batch use *ouch items script that includes Professor Ouch's Satchel?
I did, but then it broke because greasemonkey had a terrible bug that continually would reset my scripts to older versions. Seems to have cleared up now, but it works out better to do the satchel individually at the moment so I can run it again for level 55 summon items. Anyways, just add ";1926" after the 254 on line 13.
Leader of PFE league. If you wish to worship me, ask me about joining my secondary league Cult of Satan (the largest league in the game!).
User avatar
Isladar
Posts: 64
Joined: Wed Dec 29, 2010 4:10 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Isladar »

Thanks Satan!
User avatar
Patojonas
Posts: 404
Joined: Mon Nov 16, 2009 11:48 am
Contact:

Re: TH Greasemonkey thread 2.0

Post by Patojonas »

I was trying to make the early distant warning script check for a shot blanket, but I couldn't make it return the proper message when the short version is present so, if you just want to add a reminder to that box you just need to add:

Code: Select all

'<span id="blanket"><br />Check your <a href=\"/use.php?filter=instant\">blanket</a>!</span> <br />' +
IN this part of the code, as shown:

Code: Select all

mybox.innerHTML = '<div id="recon_warning_box" style="margin: 0 auto 0 auto; ' +
'width:300px; opacity: .75; filter: alpha(opacity=75); z-index:100; ' +
'margin: 5px; padding: 5px; overflow: hidden; height: auto; ' +
'font-size: 8pt; font-weight: bold; font-family: arial, sans-serif; background-color: #ccffcc; ' +
'color: #000000;"> ' +
'<span id="recycle">Loading Recylzer...</span> <br />' +
'<span id="digitizer">Loading Digitizer...</span> <br/> ' +
'<span id="pouch">Checking For Pouches...</span> <br />' +
'<span id="blanket"><br />Check your <a href=\"/use.php?filter=instant\">blanket</a>!</span> <br />' +
'<span id="computer">Checking For Computers...</span>' +
'</div>';
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

Do it a few dozen times, and you'll remember the choice groups so well that even after 4 months you get them right.
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

Yeah, it's easiest to just keep the five groups in mind:

1) Capulets (regardless of gender)
2) Montegues (regardless of gender)
3) Males
4) Females
5) Always wrong choices

Then it's (1 or 2) and (3 or 4). It's also worth keeping in mind that you can figure it out via the first two names: Bassanio is group 3 and Benvolio is group 2. If Bassanio is wrong, pick non-R&J females; otherwise non-R&J males. If Benvolio is wrong, pick Capulets; otherwise Montegues.

I suppose the logic is pretty basic, so it could be made into a script, I just don't know how to code. And, well, you're still stuck taking two blind guesses no matter what.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
zillow
Posts: 191
Joined: Thu Sep 04, 2008 5:33 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by zillow »

Thinking of adding openings support in the AA script, what features would people like? Current idea is super simple, if an opening is available use it.
Image
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

Found a new host for it? Userscripts seems to have bit the big one.

As for openings, hm. That's a little tricky. I think it would be better if you could somehow have it be selectable, because you aren't always going to want to run any opening that pops up (I'm thinking specifically of the Iceberg and yo-yo openings).
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
zillow
Posts: 191
Joined: Thu Sep 04, 2008 5:33 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by zillow »

You can still access everything at http://userscripts.org:8080/
But it does seem like the site might go down permanently.
Image
User avatar
Patojonas
Posts: 404
Joined: Mon Nov 16, 2009 11:48 am
Contact:

Re: TH Greasemonkey thread 2.0

Post by Patojonas »

About UserScripts.org
Spoiler: show
http://userscripts.org:8080/ has been down for a few days now.

Here's a link to a page describing the whole situation and workarounds: https://docs.google.com/document/d/18R7 ... edit?pli=1

Long story short, for a while we'll be able to get everything from http://userscripts-mirror.org/
Problem? Search is disabled so if you have links to any gm script you'll have to manually edit the link to get where you want to go.

As for new websites to place stuff?

Looking at that list, I favour https://monkeyguts.com/about.php

Judging by the amount of scripts it's not leading the race to be the next userscripts hub, but I find it very user friendly.
As for Opening support:

Could you perhaps make it read the openings you want to be fired from a string users get to add/remove openings to/from?

Also as mention before I'd love to be able to have conditional strategies. Something like, if (condition) do this stuff, else do that stuff

The most basic condition I guess would be checking if the foe name was one we get to have on a list and thus it'd be a match foe function that'd check the foe variable.
Another useful condition would be a match for a string in the text. Like if the disco shoes message (or part of it) that allows me to get the -1minute is present I'd want to use a strategy alternative that made use of the disco demolition skill. (I currently use this script to highlight part of that string for easier recognition)


Also I'm not really sure, but the way it works now if you set a strategy to use a skill and then an item it'll never use the item because it'll spam the skill forever right? Is it possible to make a tag to indicate we want to use an item or a skill only once (or x times)? Like, I set it to use kung fu once and then an atomic wedge twice and if the foe is alive after that the script doesn't proceed any further? I guess this would require some serious modifications to how the script works so my alts will give you 5 silver stars if you can accomplish this on top of my previous suggestions :mrgreen:


Last but not lest, add this non-combat to the new version if it doesn't already have it:

//trillowatt computer in vincille
nonComChoice["Computer Graveyard"+"choice"] = "1"; //snag computer
//nonComChoice["Computer Graveyard"+"choice"] = "2"; //leave, no time cost
nonComChoice["Computer Graveyard"+"submitvalue"] = "Make your choice";
xKiv
Posts: 162
Joined: Sat Jan 01, 2011 1:40 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by xKiv »

My openings support looks roughly like this:

Code: Select all

stratList['FarmTAF'] = 'S:1024;S:153!throwawayfoe';
note that opening IDs seem to be strings, or at least were when I last tested this

then in processStrategy I have:

Code: Select all


        } else if(selectedAction[0] == 'S')
        {
                var found       = false;
                var skillPars   = selectedAction[1].split('!');
                if (skillPars.length > 1 && qqq > 2) {
                        if (Select_Value_Set_Name('pickwhich', qqq-3, skillPars[1]))
                        {
                                nextButton      = find('.//input[@type="submit" and contains(@value,"Opening")]');
                                found           = true;
                        }
                }
                if ((!found) && Select_Value_Set_Name('pickwhich', qqq-2, skillPars[0]))
                {
                        nextButton      = find('.//input[@type="submit" and contains(@value,"Skill")]');
                        found           = true;
                }
                if (!found)
                {
                        nextButton      = find('.//input[@type="submit" and contains(@value,"Attack")]');
                }
        } else if(selectedAction[0] == 'IS')
That will only work for one specific opening, but it could be easily modified to loop through skillPars and pick the first that matches. Strategy would then look something like S:153!throwawayfoe!hammerithome!fantheflames

I don't like the idea of taking all openings as soon as they are available, because they tend to not be as useful as normal actions for me.

--

Conditional strategies: I don't have this yet, but I have thought avout it. I think what needs to be done there is just to make the strategy a function (of current combat state), and have the function return the string that should be used as strategy for current combat round.

Code: Select all

function funFun(round, foeName, openings, skills, items) {
  if (round == 1) {
    return 'S:1024';
  } else if (round == 2) {
    if (foeName == 'brundibar') {
       if ('bzz' in openings) { 
         return 'S:0!bzz';
       }
       if (9 in skills) { // tornado
         return 'S:9';
       }
       if (749 in items) { // space mead
         return 'I:749';
       }
    }
    return 'A';
  }
  return 'Q'; // give up
};
...
stratList['fun'] = funFun;
Also I'm not really sure, but the way it works now if you set a strategy to use a skill and then an item it'll never use the item because it'll spam the skill forever right?
AFAIK, only the last item on strategy is spammed repeatedly


ETA: I put my current version up at http://mascripty.wz.cz/th_autoadv_xkiv.zip
zillow
Posts: 191
Joined: Thu Sep 04, 2008 5:33 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by zillow »

Added opening support to the script, I'll be adding more features soon like use x item y times.

Also, while I was at it, fixed some issues the script was having with greasemonkey

But for now here it is with openings, let me know how you like it: https://monkeyguts.com/code.php?id=324
Image
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

Seems "Stop, Drop, and Roll" isn't flagged right. While fighting pinatas I got a popup saying that opening was missing.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
zillow
Posts: 191
Joined: Thu Sep 04, 2008 5:33 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by zillow »

Ya... I had to guess what the flags for all of them were based on ones I knew, did you see what the actual flag was?
Image
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: TH Greasemonkey thread 2.0

Post by Cristiona »

I think it was stop.drop.roll, but I'm not sure. I'll try to keep an eye out.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
User avatar
Patojonas
Posts: 404
Joined: Mon Nov 16, 2009 11:48 am
Contact:

Re: TH Greasemonkey thread 2.0

Post by Patojonas »

it'd be awesome if it could ignore the computer link when decrypting en masse.....
Harry Dresden
Posts: 1395
Joined: Tue Feb 12, 2008 1:22 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by Harry Dresden »

Does anyone else have an issue with the new-ish AA script double using whatever it's set to use first? For instance, when I have it set to use all throwing stars and then attack, it tries to use the black hole twice before moving on to the second star in the list. Or if I use my option for a recognizer bot before attacking it uses the bot twice and then attacks.
xKiv
Posts: 162
Joined: Sat Jan 01, 2011 1:40 pm
Contact:

Re: TH Greasemonkey thread 2.0

Post by xKiv »

Harry Dresden wrote:Does anyone else have an issue with the new-ish AA script double using whatever it's set to use first? For instance, when I have it set to use all throwing stars and then attack, it tries to use the black hole twice before moving on to the second star in the list. Or if I use my option for a recognizer bot before attacking it uses the bot twice and then attacks.
I remember trying to fix an issue with round numbers (as in, the script sometimes thought the first combat round is 1 and other times 0, and it was not advancing to second action until round number 2). I *think* I fixed it in my local version somehow, but I don't remember how, it's been a long time.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests