Search: Home | Atlas | Guides | Tests | Research | Index | Recent Changes | Preferences | Login

Macros > Synthetic-Angel

Just finished reading through some of the other macro pages which I hadn't done since learning to write my own macros. Seems Anka is a little ahead of me on a lot of things, and a little better. Though I think I have some things to add I realize that the game attracts a large number of professional programmers, while I don't mean to patronize anyone seems best that I over explain things. As an aside, I am not a professional programmer.

1. Why do we insist that users use same the number of racks / fires / kettles / etc that we used when making the macro?

By using two variables and three loops we can make it run any number of racks / fires / kettles that can be fit on a screen. It also makes for shorter macros too.

For Example:

Constants
Rows = 2
Columns = 2
End

Loop 1000 //However many cycles we want to run - See point 2.
Loop $Rows

  loop $Columns
    MousePos someX, someY 
    delay SomeTime
    Click		
    delay SomeTime
    compute someX = $someX + $someXMod
  end
  compute someY = someY + someYMod
  set someX = initialX
end
end

The Outermost loop determines how many complete cycles we run through
The Middle loop runs through each row.
The Inner loop runs though each Column in the current row.
So the order of the panes for a 3 by 3 grid would be as so:
1 2 3
4 5 6
7 8 9

In the case of my bonfire macro, it can handle up to 7 columns and 4 rows. It can thus be used with ($Rows * $Columns) bonfires where Rows is an integer between 1 and 4 and Columns is an integer between 1 and 7. This method allows for any number of panes between 1 and Max Rows * Max Columns, excluding prime numbers greater than the larger of the two max values.

As far as making for shorter macros, the entirety of most bonfire macros can be contained within the above code, with the exception of the lighting of the fires. If I wasn't so lazy and encapsulated some of it into procedures the entire macro could be only about twice the size as the above.

2. Why do we ask the user to calculate anything?

I only just discovered this function in ACTool but it should make requiring the user to make any sort of calculation relating to the number of cycles obsolete.

For Example:

Constants
Columns = 2 //This and the Rows Constant are related to point #1
Rows = 2 //In the spirit of allowing the user some flexibility
Wood = 3001 //How much wood do you have in inventory? We'll figure out how many loops we can do with this much wood
Loops = 0
End

Compute Loops = ($Wood / ($columns * $rows))
FormatNumber Loops = $feedloops,####.;;Zero

Loop $Loops
//Do our thing
End

This function is horribly documented. Wait, all of ACTool is horribly documented. Sad really. Basically, the compute function in this example would return 750.25, the loop procedure requires an integer which our value is not. The FormatNumber truncates the digits to the right of the decimal place effectively making it into an integer. You could presumably still break it by making wood a negative number or greater than 9999 with rows and cols = 1... But there's a limit to what I'm willing to plan for.

3. Why do we require the user to position the pane's before we run a macro?

One of the reasons I started writing my own macros was to make a 10 bonfire macro that didn't take an hour to set up and often wrongly at that. Don't get me wrong, running 28 bonfires is great! But it was taking me too long, so I started working on a way to position the panes prior to running the macro. It seems that Anka has beaten me to it, and one upped me! In any case, this may still yet serve some purpose in allowing people to adjust their personal macros to auto position.

The procedure rests on the dragto X,Y function in ACTool. Pretty self explanatory, position the mouse over the pane to be dragged and call the DragTo with the X and Y values of the desired location as it's arguments.

MousePos 843, 601
delay 150
dragto 200, 200

On to the Macros

The Charcoal Macro

Like I said, I'm too lazy to put anything in to procedures, though I promise from now on I will. In anycase, the bonfire macro comes in two parts, the first simply positions the panes. So: build a number of bonfires between 1 and 28, pin their menus and drag the menus to the bottom right hand corner. In the macro set the number of rows and columns to be the number of rows and columns desired, up to 7 columns and 4 rows. The positioning constants are set for the size of player owned / private bonfires, you shouldn't really ever find a need to adjust these. As for the second part, there are only three variables to really be concerned with. Set the number of rows and panels equal to what you have on your screen. Set Wood to be the amount of wood that you wish to use. The other variables -TotalDelay & GenDelay- can be adjusted to improve your yeild, but be aware that changing them without understanding the effects will probably result in a lot of wasted time and wood. In a 500 wood 28 fire test I acheived a little better than 76% efficiency (~4:3 Wood:CC), it has a tendency to get lagged and drop two or more of the fires. My effeciency in smaller runs wasn't a great deal better, around 80% (5:4 Wood:CC). I suspect that a little playing with the timers will greatly improve the yeilds, please post your findings.

Bricks Done Better

This macro would never have made it here without Erialor taking it and removing the various bugs, polishing it, and providing a timing system that worked for an adjustable macro. The Charcoal macro also incorporates a great deal of her work and influence. That being said, I haven't spent as much time on this one, nor did I pretty it up after learning some things with the Bonfire macro so it breaks some of my "rules" outlined above. As before, pin the menus for (Rows * columns) brick racks. Set Rows and Columns, and bricks. The timing for this macro was worked out pretty well so no changes ought to be necessary. However, in the event that they do refer to lines 51 and 52. I won't try to explain why these numbers work, partly because I've forgotten and partly because it's overly complicated. If anyone has any problems with the timing let me know and I'll clean it up and make it a bit more friendly. Running 25 racks I've achieved a brick rate of about 10k an hour. But the effeciency of running more racks diminishes after about 23 or so provided we're not clicking a great deal faster than we could in real life.

So that's that. I have of course the ubiquitos Flax processing and mining macros that are easier to write than to download. Though I've had a lot of in game questions regarding the most basic of macro writing so I may put up a tutorial on writing your own macros, course I still have a great deal to learn myself. Draeton's (We will miss you) Barley macro is a testamet to what can be done with ACTool and as of yet remains undone.

If anyone has experience with Wiki formatting and can possibly make this look prettier, please do :). Thanks.


NameCreatorDateSizeDescription
BricksDoneBetterSynthetic-AngelApril 6, 2005 8:31 am3382A better brick macro, about 10K per hour
CharcoalPart1Synthetic-AngelApril 23, 2005 4:00 am525The initial positioning portion of the Charcoal macro
CharcoalPart2Synthetic-AngelApril 8, 2005 1:34 am3128The Business portion of the Charcoal macro

Home | Atlas | Guides | Tests | Research | Index | Recent Changes | Preferences | Login
View source text of this page | | Create/Edit another page | View other revisions
Last edited April 7, 2005 7:45 am by LittleCleo (diff)
Search: