Razor Attended Mining Macro (requires mobile & metal keys)

If you make a Client-side script you can publish it here for other players to use
Locked
Jax2
Grandmaster Scribe
Reactions:
Posts: 95
Joined: Wed Apr 08, 2009 3:23 pm

Razor Attended Mining Macro (requires mobile & metal keys)

Post by Jax2 »

Hi all, I have what I believe to be a pretty decent macro. It does get a few bugs every once in a great while, but normally works like a charm.

You will need to create two macros in your %appdata%/razor/macros directory, or wherever your macros are stored on your system. They need to be named the same, mining and ingotKeys.

Set up instructions will follow the macros.

Here is the mining macro:

Code: Select all

!Loop
Assistant.Macros.IfAction|4|0|the requested target is
Assistant.Macros.HotKeyAction|1332|
Assistant.Macros.SetLastTargetAction
Assistant.Macros.EndIfAction
Assistant.Macros.IfAction|5|1|400
Assistant.Macros.SpeechAction|0|906|3|ENU|0|Full!
Assistant.Macros.ForAction|6
Assistant.Macros.DoubleClickTypeAction|6585|True
Assistant.Macros.PauseAction|00:00:00.2500000
Assistant.Macros.AbsoluteTargetAction|0|0|1090859205|161|74|0|3634
Assistant.Macros.PauseAction|00:00:00.5000000
Assistant.Macros.EndForAction
Assistant.Macros.HotKeyAction|0|Play: ingotKeys
Assistant.Macros.SetLastTargetAction
Assistant.Macros.ElseAction
Assistant.Macros.IfAction|4|0|you have worn out your tool
Assistant.Macros.SpeechAction|2|537|3|ENU|0|
Assistant.Macros.DoubleClickTypeAction|7864|True
Assistant.Macros.WaitForGumpAction|2002155655|False|1
Assistant.Macros.GumpResponseAction|8|0|0
Assistant.Macros.WaitForGumpAction|2002155655|False|1
Assistant.Macros.GumpResponseAction|72|0|0
Assistant.Macros.WaitForGumpAction|2002155655|False|1
Assistant.Macros.PauseAction|00:00:00.7500000
Assistant.Macros.ElseAction
Assistant.Macros.DoubleClickTypeAction|3897|True
Assistant.Macros.WaitForTargetAction|1
Assistant.Macros.LastTargetAction
Assistant.Macros.PauseAction|00:00:01
Assistant.Macros.ElseAction
Assistant.Macros.IfAction|4|0|dig some
Assistant.Macros.DoubleClickTypeAction|3897|True
Assistant.Macros.WaitForTargetAction|1
Assistant.Macros.LastTargetAction
Assistant.Macros.PauseAction|00:00:01
Assistant.Macros.ElseAction
Assistant.Macros.IfAction|4|0|no metal
Assistant.Macros.SpeechAction|0|906|3|ENU|0|Move on!
Assistant.Macros.DoubleClickTypeAction|3897|True
Assistant.Macros.PauseAction|00:00:05
Assistant.Macros.EndIfAction
Assistant.Macros.IfAction|4|0|target cannot be seen.
Assistant.Macros.DoubleClickTypeAction|3897|True
Assistant.Macros.PauseAction|00:00:02.5000000
Assistant.Macros.EndIfAction
Assistant.Macros.EndIfAction
Assistant.Macros.EndIfAction
Assistant.Macros.EndIfAction

and ingotKeys.macro:

Code: Select all

Assistant.Macros.DoubleClickAction|1094255793|5995
Assistant.Macros.ForAction|8
Assistant.Macros.PauseAction|00:00:00.2500000
Assistant.Macros.GumpResponseAction|15|0|0
Assistant.Macros.PauseAction|00:00:00.1250000
Assistant.Macros.TargetTypeAction|False|7154
Assistant.Macros.EndForAction
Assistant.Macros.GumpResponseAction|0|0|0
Assistant.Macros.PauseAction|00:00:00.2500000
Assistant.Macros.HotKeyAction|1332|
Assistant.Macros.PauseAction|00:00:01
Assistant.Macros.HotKeyAction|0|Play: mining
SETUP INSTRUCTIONS

This is pretty straight forward. You need to have in your bag the following:

Shovel with a high use amount
*(The script was originally set up to create a new shovel using tinker tools if it broke, but because of the keys portion of this updated version, the iron ingots go to your keys and are not available for tinkering)

Mobile Forge

Metal Worker's Keys

Load mining.macro in razor. The script is set up to target by type (shovel) but if for some strange reason it cannot find your shovel, you may have to highlight the lines that say Double Click (shovel(0F39)), right click, click on retarget and click your shovel.

Inside the ingotKeys macro, you will need to click on "Absolute Target" and retarget that to your metal worker's keys. I also carry other keys, so using target by type was not plausible.

Run the mining.macro.

You will be given a target, click where you'd like to mine. When your bag hits 400 weight (You can adjust the weight in the macro near the top), it will automatically smelt all your ores on the mobile forge (*Note: It goes through a loop of 6 currently , if you ever find yourself digging up more than 6 types of ore before you are "full", feel free to change this number. You can also make it less to speed up the macro if you never need 6...)

After the ingots are created, it will open up ingotKeys and add, again in a 6 loop, all the ingots to your keys. It will close the gump, cancel last target and restart mining, asking you to retarget.

If there is nothing to mine in a spot, you will have a new target and about 5 - 6 seconds to walk to a new spot and click it. If again, nothing to mine, just walk again. So yeah, the only thing you really need to do is move and click the next spot, the rest is all automated.

Let me know what you think, or if you can make it even better...
User avatar
Wil
Legendary Scribe
Reactions:
Posts: 1228
Joined: Mon Dec 30, 2013 1:19 pm
Location: Seattle, WA, USA
Contact:

Re: Razor Attended Mining Macro (requires mobile & metal keys)

Post by Wil »

One good turn deserves another. Here's a perl script which *creates* a recall mining macro. It expects to mine only in caves and will mine both the rune-marked squares and the squares to the east, south and southeast. Output of the perl script is a whole bunch of razor macros that jump from one to the next as the "no metal here" condition is met.

Adjustments you will need to make:

In your Razor macros folder, create a folder called "Minax". Inside Minax, create another folder called "recall". The razor macros created by this script go in the Minax\recall folder

Change @runes to contain your mining runes. Mark runes in the exact southeast corner of the primary squares you want to mine so that the script can also reach the squares to the south, east and southeast of it. You can find the resource square boundaries by mining everything at a location and then moving and mining one step at a time until you start getting ore again. This script expects all runes to be marked in caves or dungeons where it's possible to mine relative location 0,0.

Change $homerune to a rune which takes you back to a safe area when the script is done.

Change DoubleClickAction|1130627326|5995 to match your stoneworker's keys

Change AbsoluteTargetAction|0|0|1154136256|30|78|0|3634 to match your mobile forge

Change DoubleClickAction|1154197366|5995 to match your metalworker's keys

Finally, run the "m1recall" macro and let Razor take over from there.

Tip: Color ore is in the same spots in both Malas and Magda Malas. Mark one, mark the other.

Code: Select all

#!/usr/bin/perl


$recall = <<EOF;
Assistant.Macros.IfAction|4|0|no metal here
Assistant.Macros.EndIfAction
Assistant.Macros.ExtCastSpellAction|32|4294967295
Assistant.Macros.WaitForTargetAction|30
Assistant.Macros.AbsoluteTargetAction|0|0|RUNE|0|7956
Assistant.Macros.PauseAction|00:00:02.0000000
// hide
Assistant.Macros.UseSkillAction|21
Assistant.Macros.PauseAction|00:00:00.4000000
Assistant.Macros.HotKeyAction|0|Play: Minax\\JUMPTO
EOF

@runes = ( "1138566913|45|66", "1138610365|56|66", "1138629052|67|66",
"1138640721|78|66", "1138652298|89|66", "1138667911|99|66",
"1138593811|45|81", "1138681180|56|80", "1138691050|67|80",
"1138691053|78|79", "1138691062|89|79", "1138720770|100|80"
);

#$homerune = $runes[0];
#$lastjump = "recall";
$homerune = "1167757948|141|66";
$lastjump = "done";

$minesome = <<EOF;
!Loop
// Mine here
Assistant.Macros.ForAction|10
Assistant.Macros.DoubleClickTypeAction|3897|True
Assistant.Macros.WaitForTargetAction|3
Assistant.Macros.TargetRelLocAction|MINEWHERE
Assistant.Macros.PauseAction|00:00:00.7000000
Assistant.Macros.IfAction|4|0|no metal here
// Mined out, try south
// Smelt
Assistant.Macros.ForAction|2
Assistant.Macros.DoubleClickTypeAction|6585|True
Assistant.Macros.PauseAction|00:00:00.2000000
Assistant.Macros.AbsoluteTargetAction|0|0|1154136256|30|78|0|3634
Assistant.Macros.PauseAction|00:00:00.3000000
Assistant.Macros.EndForAction
// Collect stone
Assistant.Macros.DoubleClickAction|1130627326|5995
Assistant.Macros.WaitForGumpAction|2633467501|False|300
Assistant.Macros.PauseAction|00:00:00.1000000
Assistant.Macros.GumpResponseAction|15|0|0
Assistant.Macros.ForAction|3
Assistant.Macros.PauseAction|00:00:00.4000000
Assistant.Macros.TargetTypeAction|False|6009
Assistant.Macros.EndForAction
// jump to south
Assistant.Macros.HotKeyAction|0|Play: Minax\\JUMPTO
Assistant.Macros.EndIfAction
Assistant.Macros.EndForAction
// smelt every 10 mining attempts
Assistant.Macros.ForAction|2
Assistant.Macros.DoubleClickTypeAction|6585|True
Assistant.Macros.PauseAction|00:00:00.2000000
Assistant.Macros.AbsoluteTargetAction|0|0|1154136256|30|78|0|3634
Assistant.Macros.PauseAction|00:00:00.3000000
Assistant.Macros.EndForAction
EOF

$minehere = "0|0";
$minesouth = "0|2";
$mineeast = "2|0";
$minesoutheast = "2|2";

$collect = <<EOF;
// Collect ore
Assistant.Macros.PauseAction|00:00:00.2000000
Assistant.Macros.DoubleClickAction|1154197366|5995
Assistant.Macros.WaitForGumpAction|4213074123|False|300
Assistant.Macros.PauseAction|00:00:00.1000000
Assistant.Macros.GumpResponseAction|15|0|0
Assistant.Macros.ForAction|5
Assistant.Macros.PauseAction|00:00:00.4000000
Assistant.Macros.TargetTypeAction|False|7154
Assistant.Macros.EndForAction
Assistant.Macros.PauseAction|00:00:00.2000000
// Collect stone
Assistant.Macros.DoubleClickAction|1130627326|5995
Assistant.Macros.WaitForGumpAction|2633467501|False|300
Assistant.Macros.PauseAction|00:00:00.1000000
Assistant.Macros.GumpResponseAction|15|0|0
Assistant.Macros.ForAction|3
Assistant.Macros.PauseAction|00:00:00.4000000
Assistant.Macros.TargetTypeAction|False|6009
Assistant.Macros.EndForAction
Assistant.Macros.PauseAction|00:00:00.2000000
Assistant.Macros.TargetRelLocAction|0|0
Assistant.Macros.PauseAction|00:00:00.4000000
Assistant.Macros.HotKeyAction|0|Play: Minax\\JUMPTO
EOF

$prefix="recall\\";
$count = 1;
foreach $rune (@runes) {
  open $f, ">m${count}recall.macro";
  $o = $recall;
  $o =~ s/RUNE/$rune/g;
  $o =~ s/JUMPTO/${prefix}m${count}minehere/g;
  print $f $o;
  close ($f);
  open $f, ">m${count}minehere.macro";
  $o = $minesome;
  $o =~ s/MINEWHERE/$minehere/g;
  $o =~ s/JUMPTO/${prefix}m${count}minesouth/g;
  print $f $o;
  close ($f);
  open $f, ">m${count}minesouth.macro";
  $o = $minesome;
  $o =~ s/MINEWHERE/$minesouth/g;
  $o =~ s/JUMPTO/${prefix}m${count}mineeast/g;
  print $f $o;
  close ($f);
  open $f, ">m${count}mineeast.macro";
  $o = $minesome;
  $o =~ s/MINEWHERE/$mineeast/g;
  $o =~ s/JUMPTO/${prefix}m${count}minesoutheast/g;
  print $f $o;
  close ($f);
  open $f, ">m${count}minesoutheast.macro";
  $o = $minesome;
  $o =~ s/MINEWHERE/$minesoutheast/g;
  $o =~ s/JUMPTO/${prefix}m${count}collect/g;
  print $f $o;
  close ($f);
  open $f, ">m${count}collect.macro";
  $o = $collect;
  $count ++;
  $o =~ s/JUMPTO/${prefix}m${count}recall/g;
  print $f $o;
  close ($f);
}
open $f, ">m${count}recall.macro";
$o = $recall;
$o =~ s/RUNE/$homerune/g;
$o =~ s/JUMPTO/${prefix}m1$lastjump/g;
print $f $o;
close ($f);

Locked