Simple Combine.mac

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Simple Combine.mac

Post by kagonis » Wed May 28, 2003 5:23 am

Well, since I didn't want to wait on the /finditem I made a macro that temporarely solves that problem.

This macro basically just needs to be told a few things before start.
1) Total number of bags, excluding the combiner you may have in your inventory.

Code: Select all

/varset totBags 8
2) The X Y coordinates of the top-left slot of each bag. These are set in an array like a(21,#), where # is the bag number.

Code: Select all

/varset a(21,1) "1205 120"
3) The number of slots in the bag, again in an array, like a(22,#), again # is the bag number.

Code: Select all

/varset a(22,1) 10
4) The X Y coordinates of the top-left slot in the combiner.

Code: Select all

/varset cmbPos "405 120"
5) The X Y coordinates of the Combine button, on the combiner.

Code: Select all

/varset cmbBtn "425 315"
6) The number of slots in the combiner (isn't used yet, but was going to be used for some checking, so not trying to put 9 items in an 8 slot combiner etc.)

Code: Select all

/varset cmbSlots 10
The above steps should be onetime settings, you enter them once and then forget about them AS LONG AS YOU DON'T MOVE AROUND THE BAGS AFTER THEY ARE SET.

Items to be added to the combiner are added with 2 lines like this:

Code: Select all

/varset curItem "Large Block of Clay"
/call chkItem
/varset curItem "Water Flask"
/call chkItem
/varset curItem "Water Flask"
/call chkItem
And when all items have been added the doCombine is set:

Code: Select all

/call doCombine
Now the macro starts indexing all your bags, this takes a little minute, after that it starts combining the items specified, setting emptied slots as empty, so it won't try to take anything from that slot when emptied.
This makes it safe to let it drop items into previously emptied slots.

The script have been tested on pottery only, 3 different combines, all successfull, should be able to do any combine that it has the items for.
If you want it to destroy items rather than keep then just modify the script to do it.

Edit:Added the dsSlot variable for the distance between each slot in a bag, the default UI have a distance of 40.

Code: Select all

#turbo
#define totBags v1
#define curBag v2
#define curSlot v3
#define mouseX1 v4
#define mouseX2 v5
#define mouseY v6
#define chkCol v7
#define tmp01 v8
#define tmp02 v9
#define tmp03 v10
#define tmp04 v11
#define tmp05 v12
#define curItem v13
#define cmbPos v14
#define cmbSlots v15
#define cmbSlot v16
#define cmbBtn v17
#define dsSlot v18

sub main
	/varset a(21,1) "1205 120"
	/varset a(22,1) 10
	/varset a(21,2) "1105 120"
	/varset a(22,2) 10
	/varset a(21,3) "1005 120"
	/varset a(22,3) 10
	/varset a(21,4) "905 120"
	/varset a(22,4) 10
	/varset a(21,5) "805 120"
	/varset a(22,5) 10
	/varset a(21,6) "705 120"
	/varset a(22,6) 10
	/varset a(21,7) "605 120"
	/varset a(22,7) 10
	/varset a(21,8) "505 120"
	/varset a(22,8) 10

	/varset cmbPos "405 120"
	/varset cmbSlots 10
	/varset cmbBtn "425 315"
	/varset totBags 8
	/varset chkCol 0
	/varset dsSlot 40

	/call bagWalk
	:loop
		/press ctrl
		/press shift
		/press alt
		/varset cmbSlot 0
		/varset curItem "Unfired Casserole Dish"
		/call chkItem
		/varset curItem "High Quality Firing Sheet"
		/call chkItem
		/call doCombine
		/goto :loop
/return

sub doCombine
	/mouseto $cmbBtn
	/click left
	/delay 5
	/if "$cursor()"!="NULL" {
		/click left auto
		/delay 1
	}
/return

sub chkItem
	/varset curBag 1
	:bagLoop
		/varset curSlot 1
	:slotLoop
		/if "$a($curBag,$curSlot)"~~"$curItem" {
			/mouseto $a(21,$curBag)
			/varset mouseX1 $mouse(X)
			/varset mouseX2 $mouse(X)
			/varadd mouseX2 $dsSlot
			/varset mouseY $mouse(Y)
			/varcalc tmp01 $curSlot-1
			/varcalc mouseY $mouseY+$tmp01/2%$curSlot*$dsSlot
			/varcalc chkCol $curSlot%2
			/if n $chkCol==1 /mouseto $mouseX1 $mouseY
			/if n $chkCol==0 /mouseto $mouseX2 $mouseY
			/call addItem
			/varsub a(1$curBag,$curSlot) 1
			/if n $a(1$curBag,$curSlot)==0 {
				/varset a($curBag,$curSlot) "empty"
			}
			/goto :End
		} else /if n $curSlot<$a(22,$curBag) {
			/varadd curSlot 1
			/goto :slotLoop
		}
		/if n $curBag<$totBags {
			/varadd curBag 1
			/goto :bagLoop
		}
		/echo Error: Out of $curItem, aborting.
		/endmacro
	:End
/return

sub bagWalk
	/echo Indexing...
	/varset curBag 1
	:bagLoop
		/mouseto $a(21,$curBag)
		/varset curSlot 1
		/varset mouseX1 $mouse(X)
		/varset mouseX2 $mouse(X)
		/varadd mouseX2 $dsSlot
		/varset mouseY $mouse(Y)
	:slotLoop
		/varcalc chkCol $curSlot%2
		/if n $chkCol==1 /mouseto $mouseX1 $mouseY
		/if n $chkCol==0 /mouseto $mouseX2 $mouseY
		/sendkey down shift
		/click left
		/sendkey up shift
		/delay 1
		/if "$cursor()"!="NULL" {
			/varset a($curBag,$curSlot) "$cursor(name)"
			/varset a(1$curBag,$curSlot) $cursor(stack)
			/if n $chkCol==1 /mouseto $mouseX1 $mouseY
			/if n $chkCol==0 /mouseto $mouseX2 $mouseY
			/click left
			/delay 1
		} else {
			/varset a($curBag,$curSlot) "empty"
			/varset a(1$curBag,$curSlot) 0
		}
		/if n $curSlot<$a(22,$curBag) {
			/varadd curSlot 1
			/if n $chkCol==0 /varadd mouseY $dsSlot
			/goto :slotLoop
		}
		/if n $curBag<$totBags {
			/varadd curBag 1
			/goto :bagLoop
		}
	:End
	/echo Finished indexing...
/return

sub addItem
	/if n $cmbSlot<1 {
		/varset cmbSlot 1
	} else {
		/varadd cmbSlot 1
	}
	/varcalc chkCol $cmbSlot%2

	/sendkey down ctrl
	/click left
	/sendkey up ctrl
	/delay 1
	/if n $cursor(stack)>1 {
		/echo Error: Got $cursor(stack)x $cursor(name), aborting.
		/endmacro
	}
	/mouseto $cmbPos
	/varset mouseX1 $mouse(X)
	/varset mouseX2 $mouse(X)
	/varadd mouseX2 $dsSlot
	/varset mouseY $mouse(Y)
	/varcalc tmp01 $cmbSlot-1
	/varcalc mouseY $mouseY+$tmp01/2%$cmbSlot*$dsSlot
	/varcalc chkCol $cmbSlot%2
	/if n $chkCol==1 /mouseto $mouseX1 $mouseY
	/if n $chkCol==0 /mouseto $mouseX2 $mouseY
	/click left
	/delay 1
	:End
/return
Last edited by kagonis on Wed May 28, 2003 12:46 pm, edited 1 time in total.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Looks like an interesting macro...

Post by wassup » Wed May 28, 2003 11:12 am

I see that you are using the standard UI. Would it be possible for you to add in a variable to be able to modify the vertical and horizontal shifts to a user defined value?

I ask this because I modified my EQUI_Container.xml file to have considerably smaller slots.

Does it matter where in the bags the components are? From what I can tell it doesn't look like it matters, but I thought I would ask to make sure.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Wed May 28, 2003 12:49 pm

Added dsSlot variable for distance between slots in above example.

No, it is completely irrelevant where in the bags you place the items, the very first thing tha macro does, is to look through all your bags and remember what is in each slot, and the amount.
When the actual combining starts the macro knows exatly what slots, the components are in, and it will not pick up combined items, because those would be autoequipped into slots that are marked as empty to the macro.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Wed May 28, 2003 8:54 pm

Thanks... I will give this a try later tonight. Still working on some smithing to finish that fiendish Aid Grimal quest and have to do some pre-combines.

If you don't mind I might try to implement the useage of tools in your macro. Alot of what I am doing now uses one or two tools to do the combine.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Thu May 29, 2003 2:10 am

Ah yes, I knew I forgot something.

I'm too tired to work out something smart for that right now, but I have the idea allready though, but would require some help, at least to understand more about MQ scripting.

My idea would be to change the way addItem (or chkItem if you like) works.

My idea is that I should call my sub with certain operators, kinda like:
Syntax: /call addItem <int> <"string"> [bool]

Operator 1 is the number of that component to be added.
Operator 2 is the name of the component to be added.
Operator 3 is a boolean that tells the macro wether to expect that item to be returned.

Example:
/call addItem 1 "Plant Shoot"
/call addItem 1 "Cheese"
/call addItem 1 "Noodles"
/call addItem 1 "Casserole Dish" TRUE

My idea is then, that whenever the macro is told that the item is returned after the combine, it saves the original bag number and slot number, so it can return that component to it's original place after each combine.

Anyway, how to do it I don't know right now, I just know I want the script to be relatively smart, compact and pretty (reason for my bagwalk idea).

Feel free to come up with a solution, and by all means post it here so we can see it, and make suggestions and/or modifications :)

Right now though, I'm going to bed ;)

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu May 29, 2003 8:07 am

Y'know Wassup, if you need smithing done I could use a wealthy patron to fund my skillups :twisted: I'd still like to get to 255 so I can make some Night Terror Plate....
MQ2: Think of it as Evolution in action.

Pigeon
orc pawn
orc pawn
Posts: 22
Joined: Fri May 16, 2003 9:43 pm

Post by Pigeon » Thu May 29, 2003 2:35 pm

Max base skill is 250. With a +blacksmithing item, max skill is 252.

Best thing to do is get to 240 or so and get a geerlock. Better yet, get a geerlock, and then get 240. I've been told multiple +mod items stack, so you could do 230 and get a geerlock + trophy, but I've yet to see any hard evidence proving such.

btw- planar tradeskilled stuff isn't worth getting into a tradeskill for. If you want to GM a tradeskill, it should be because you want to GM that tradeskill, not because you want a piece of gear you can make from that tradeskill. By the time you spent a few dozen thousand pp and god knows how many hours at the forge, you'd be far, far, far better off just buying the stuff you want in the bazaar and using all that time you saved farming xp. Also, don't think that you'll recoup the money you spent on a tradeskill- you won't. There are enough people out there with every tradeskill GM'd that somewhere in the bazaar, there's someone trying to sell a tradeskilled item worth 5k for 4k just so he can get back some of the money he spent on the parts.

People with smithing/tailoring/pottery gm'd are people who either A) got into the tradeskill earlier than everyone else did, and made a killing because (s)he was one of 4 people who can make any given item, B) someone who's rich and wanted to GM a tradeskill for roleplaying reasons, or for the convenience of not having to ask someone they know with the tradeskill GM'd, or C) someone who thought they'd make money doing it and ended up just wasting money. There's also a huge group of people who got the skill to 180-200 or so and went broke, got bored, or realized they'd turn into group C if they gm'd it.

Oh, hello? Oh yeah, the topic you were looking for is -----------> thataway.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu May 29, 2003 5:11 pm

eh, mostly doing it cause I want to, not just because I want to make planar armor... which, by the way, I've never seen for sale. Oh, plenty of chain, but no planar plate. Go figure.

And I'm broke anyway :) Pretty much continously. And that's not from smithing. I level in that by making Shadowscream... talk about monotonous! Takes weeks just to get enough components together to make a dozen attempts, and that's if I do nothing else.

A shame I ran out of money before the banded nerf, or I'd be much farther along.

Still, would be nice to have a complete suit of Night Terror Plate... just 'cause I like the name. I doubt I'll ever have the money to make it, or the money to get my skill high enough to make it, but I can dream :)

P.S. Already got a Geerlok, bought that a long time ago.
MQ2: Think of it as Evolution in action.

renagade8
orc pawn
orc pawn
Posts: 28
Joined: Sat Oct 19, 2002 9:17 pm

Post by renagade8 » Thu May 29, 2003 5:32 pm

+mods dont stack, it takes the highest % mod you have

banananose
orc pawn
orc pawn
Posts: 27
Joined: Sun Sep 01, 2002 8:13 am

Post by banananose » Thu May 29, 2003 6:05 pm

Great script :) I had an idea that perhaps the array routines you use to store the inventory could be used to make a revamped "sell item" macro, whereby you tell the macro the mouseloc of the sell button on the vendor, then call it with the item you want to sell as a parameter. Something I may get a chance to fool around with over the weekend - unless someone already has it worked out? Or another "sell item" workaround?