H&H Groovy Maid

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

H&H Groovy Maid

Postby Momoka » Wed Jan 18, 2012 12:22 am

Groovy Maid is a scripting engine for H&H based on groovy, it puts at your disposal methods to automate certain tasks.

This is a complete rewrite of Groovy Bot client in a sane and easy to understand interface. It consists in an object, the maid, that tries to do everything for you. It acts as an addon to any client.

= Features =
- Runs over any client that respects the original client interfaces.
- Simple interface.
- Event based. More accurate than pinging every x seconds for a variable.

= Todo =
- Finish multi.session support. Right now for some reason switching between accounts and returning has a black window in most cases, it's a refresh issue.
- Allow access to global positioning. Right now only relative positioning is available. Global x,y keep changing, I need a way around that.
- Some methods available in Arksu's are missing due to ugly.
- Some methods available in Groovy Bot are missing due to lazy.
- Console commands.
- Comment the code!

= Download =
Binary: http://hnh-groovy-maid.googlecode.com/files/maid.jar
Dependencies: http://hnh-groovy-maid.googlecode.com/f ... encies.zip
Source: http://code.google.com/p/hnh-groovy-maid/source

= Instalation =
Groovy Maid runs over any client. Unpack the dependencies and place maid.jar where haven.jar can be found. Run maid.jar instead of haven.jar in your command:

java -Xms256m -Xmx512m -jar build/maid.jar moltke.seatribe.se

Depends on the following files:

= Usage =
- Pressing SHIFT + F1 runs the file "scripts/f1.groovy" You can have up to "scripts/f12.groovy".
- Pressing SHIFT + ESC cancels the running script.
- Using console you can invoke a certain filename :bot test will run "scripts/test.groovy" (TODO)

There is a multi-session support in beta, I do not recommend using it. WARNING BUGGY
- New session: ALT + INSERT.
- Destroying session: ALT + DELETE.
- Switching sessions back or forward: ALT + PGUP; ALT + PGDOWN.
- Switching sessions to the start or the end: ALT + HOME; ALT + END.

= ChangeLog =
2012-01-17 - Public release.
Last edited by Momoka on Wed Jan 18, 2012 12:38 am, edited 2 times in total.
User avatar
Momoka
 
Posts: 46
Joined: Sun Jul 17, 2011 6:21 am

Re: H6H Groovy Maid

Postby Momoka » Wed Jan 18, 2012 12:22 am

= Reference =
For now please refer to Maid.java to know what to do.
I will publish the apidoc next.

= Examples =
This is a very basic planting script. Don't forget to previously autosort your seeds, drop those you don't want! We could check the quality here, you are free to do anything. "scripts/f1.groovy" Press SHIFT + F1 to run. SHIFT + ESC to stop.
Code: Select all
import haven.Item;
import haven.Coord;

// How many tiles until next row.
int x = 5;
// Should we flip the x/y axis?
boolean flip = true;

def items;
// Inventory has to be open.
// get all the widgets in screen that belong to the Item class.
items = maid.getWidgets(Item.class);

// Let's check every item.
for (def i in items) {
        // what's the item's name?
        def n = maid.getName(i);

        // If it is a Seedbag, open it!
        if ("Seedbag".equals(n)) {
                maid.doInteract(i);
        }       
}

// Let's ask the user what kind of seed wants to plant.
// Select a seed and plant it where you want to begin
def type = maid.waitForRelease();

// Where do we stand?
Coord ref = maid.getCoord();

// Oh, we got a seed, let's check the name.
def name = maid.getName(type);

// Going to retrieve all the items again because we opened those bags.
items = maid.getWidgets(Item.class);

// Let's go through every item and see if it matches our seed type.
int count = 1;
for (def i = 0; i < items.size(); i++) {
        def item = items[i];

        // Is the name equal? Plant it then!
        def n = maid.getName(item);
        if (name.equals(n)) {
                // pick the item
                maid.doTake(item);

                // Wait so we get a server response.
                maid.waitForGrab();

                // Get to the planting! Relative to the first placement it is. So we get the ofsets.
                // Something square, we limit ourselves to x number of tiles before we jump to the next.
                int offsetx = maid.toTile(count % x);
                int offsety = maid.toTile((int) (count / x));

                if (flip) {
                        maid.doInteract(ref.add(offsety, offsetx), 0);
                } else {
                        maid.doInteract(ref.add(offsetx, offsety), 0);
                }

                // Wait for server response, always important.
                maid.waitForRelease();

                count++;
        }
}


I will add more...
Last edited by Momoka on Wed Jan 18, 2012 12:31 am, edited 3 times in total.
User avatar
Momoka
 
Posts: 46
Joined: Sun Jul 17, 2011 6:21 am

Re: H6H Groovy Maid

Postby Momoka » Wed Jan 18, 2012 12:25 am

Being a wizard in H&H is fun too! Don't let those warriors, hunters or farmers tell you how to play the game. Wizardy is a game feature itself too. You can always multiclass too.
Discussion goes here: viewtopic.php?t=24768

The output console is quite noisy right now, it helps you write scripts so it is useful to watch. I should make it optional.

This thread is for help, support and suggestions. You can always give me a hand in the documentation... pretty please?
User avatar
Momoka
 
Posts: 46
Joined: Sun Jul 17, 2011 6:21 am

Re: H&H Groovy Maid

Postby Jester87 » Thu Jan 19, 2012 6:47 am

Why not just work in my thread?
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: H&H Groovy Maid

Postby Momoka » Thu Jan 19, 2012 7:54 am

It doens't use the same interface.

Scripts written there, won't work here. Same with the opposite.
User avatar
Momoka
 
Posts: 46
Joined: Sun Jul 17, 2011 6:21 am

Re: H&H Groovy Maid

Postby Jester87 » Thu Jan 19, 2012 8:05 am

Momoka wrote:It doens't use the same interface.

Scripts written there, won't work here. Same with the opposite.


I know, but it seems like you are reinventing the wheel. Is this bot going to offer something that the one in my thread wont?
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: H&H Groovy Maid

Postby sabinati » Thu Jan 19, 2012 4:31 pm

it's a scripting engine that runs over any client
User avatar
sabinati
 
Posts: 15513
Joined: Mon Jul 13, 2009 4:25 am
Location: View active topics

Re: H&H Groovy Maid

Postby Jester87 » Thu Jan 19, 2012 6:09 pm

sabinati wrote:it's a scripting engine that runs over any client


I guess thats somewhat useful. Although, the ark.su client works just fine imho.
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: H&H Groovy Maid

Postby Momoka » Thu Jan 19, 2012 9:03 pm

Jester87 wrote:
sabinati wrote:it's a scripting engine that runs over any client


I guess thats somewhat useful. Although, the ark.su client works just fine imho.


It works. It's also an awful mess of methods and ugly hacks. That's why I am making this one. Though I can only work in it on weekends.
User avatar
Momoka
 
Posts: 46
Joined: Sun Jul 17, 2011 6:21 am

Re: H&H Groovy Maid

Postby krikke93 » Thu Jan 19, 2012 10:17 pm

Seems nice, I'm gonna test it tomorrow :)
Hope you have a great day
User avatar
krikke93
 
Posts: 3311
Joined: Tue Nov 02, 2010 7:23 pm
Location: Belgium

Next

Return to The Wizards' Tower

Who is online

Users browsing this forum: Claude [Bot] and 0 guests