Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Thu Nov 21, 2024 7:26 pm

All times are UTC




Post new topic Reply to topic  [ 92 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10  Next
Author Message
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Tue Nov 15, 2011 11:37 pm 
Contributor
Contributor



Joined: Sun Jun 12, 2011 9:44 am
Posts: 76
Location: France
Been thanked: 4 time(s)
Has thanked: 1 time(s)
Contribution Points: 105
My bot is posted and for now memory pointers are up to date, but I'm only using player's HP and MP pointers.
I'm currently playing to this nice game so I'll try to update memory pointers asap.


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Wed Nov 16, 2011 1:34 am 
VIP Contributor
VIP Contributor
User avatar



Joined: Mon Sep 12, 2011 8:36 pm
Posts: 1307
Location: Steins;Gate
Been thanked: 91 time(s)
Has thanked: 0 time(s)
Contribution Points: 15369
Alright, looking forward to it. :lol:

_________________
Image
Code:
> Meanwhile at Blue Eye Macro...
> BEM Video Games Department - Moderator, Coder, Debugger, Math/Physics & Algorithm Enthusiast - USA
Current Project: Mod Duty


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Tue Jan 31, 2012 8:00 pm 


So I am completely new to this and don't understand any of it. (I know, I'm an idiot) I downloaded the macro program for perfect world but I can't find a tutorial for setting it up for perfect world, nor a format in which to place the posted settings from the forum. sorry I'm lost and don't know where to start :cry:


Top
  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Fri Feb 03, 2012 11:53 am 
VIP Contributor
VIP Contributor
User avatar



Joined: Mon Sep 12, 2011 8:36 pm
Posts: 1307
Location: Steins;Gate
Been thanked: 91 time(s)
Has thanked: 0 time(s)
Contribution Points: 15369
I recommend starting something a lot simpler than this bot and learn some essentials. Check out our guides here: viewforum.php?f=123

_________________
Image
Code:
> Meanwhile at Blue Eye Macro...
> BEM Video Games Department - Moderator, Coder, Debugger, Math/Physics & Algorithm Enthusiast - USA
Current Project: Mod Duty


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Thu May 24, 2012 1:08 pm 
New User
New User



Joined: Fri Jul 29, 2011 1:00 pm
Posts: 23
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 160
so gigus can u plz fix blue eye macro for eden eternal


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Sat Jun 02, 2012 9:57 am 
New User
New User



Joined: Fri Jul 29, 2011 1:00 pm
Posts: 23
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 160
hey gigus is blue eye working for eden eternal


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Tue Jun 26, 2012 3:06 pm 
Active User
Active User



Joined: Tue May 15, 2012 2:56 am
Posts: 33
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 21
wow, hats off to you on coding all that! You are awesome : )


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Wed Jun 27, 2012 6:08 pm 
Active User
Active User



Joined: Tue Apr 24, 2012 3:28 pm
Posts: 46
Been thanked: 4 time(s)
Has thanked: 3 time(s)
Contribution Points: 80
any updates for this macro?


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Wed Jun 27, 2012 11:37 pm 
Silver Contributor
Silver Contributor
User avatar



Joined: Tue Jun 19, 2012 10:11 pm
Posts: 151
Location: Indonesia
Been thanked: 14 time(s)
Has thanked: 5 time(s)
Contribution Points: 33
WOW
it just to perfect..
are you make it alone??AWESOME dude


Top
 Profile  
Reply with quote  
 Post subject: Re: Perfect Bot v1.3
Thanked: 0 time(s)  Unread post Posted: Mon Jul 16, 2012 9:38 am 
Active User
Active User



Joined: Tue Jul 10, 2012 4:53 pm
Posts: 37
Been thanked: 23 time(s)
Has thanked: 3 time(s)
Contribution Points: 115
Gigus wrote:
Here is my first attempt at a full blown game bot.

The bot is for the game Perfect World, which is a free MMORPG with more than 50 million players world wide.

The bot will Hunt, track down monsters, kill them, automatically pick up drops and cash.
It will keep your character safe by healing, activating buffs, meditating to regen HP / MP and even if you should die, (which I didn't during my 4 days non-stop testing) the bot will automatically revive, heal it self, and fly back to the desired hunting ground, and continue where it left off.

If your HP or MP gets low during a fight, it will automatically use HP/MP potions, if you set the tress-hold percentages higher than those for meditation, it will use potions instead of meditating, to save time, level faster, but you will need to spent more money on potions.

If a monster attacks you while you are meditating, meditation will immediately be aborted, and the bot will start defending itself.

Also the bot will automatically travel from place to place as it levels up, to ensure you are always leveling at the best spot.

The different coordinates are stored inside a txt file which contains the leveling path.

For my testing I created the following leveling path file:
Code:
Syntax: :Level: X-Coordinate Y-Coordinate Z-Coodinate(height) Range

Level = From which level should the provided coordinates apply.
X-Coordinate = The X coordinate of the desired hunting ground.
Y-Coordinate = The Y coordinate of the desired hunting ground.
Z-Coordinate = The height at which your character should fly at, when flying towards this location.
Range = How far away from these coordinates should your character be allowed to run before returning to the desired location.

Example:
:1: 150 150 25 5
:3: 250 250 35 5
This will make any level 1 character remain within a range of 5 of the coordinates 150/150 and will remain a flying height of 25 while flying, once reaching level 2, your character will remain at the level 1 hunting grounds since no path for level 2's was provided.
As soon as your character reaches level 3, it will automatically fly to 250/250 in a flying height of 35, and once there, remain within a range of 5

Enter your leveling paths below this line (do not remove this line).
--------------------------------------------------------------------
:1: 356 452 28 5
:3: 352 439 28 5
:7: 390 479 30 6
:9: 350 322 32 6
:11: 316 543 58 8
:18: 389 566 60 6
:21: 392 592 60 6
:26: 455 630 60 6

You can download my leveling path file here:
Attachment:
Perfect World Path.txt


The macro will load this txt file in to memory, and use it to determine where to go hunting at which levels.

Everything the macro needs to know while running is read directly from memory, meaning it does not matter at what resolution your game is running.
All inputs to the game, is done by manipulating memory / sending messages directly to the window, this means the window does not have to be focused while it is playing, you can use your computer for other stuff while the bot plays the game.

However, Do not minimize the game! If you do - the dialog to fly to new coordinates will appear in the wrong spot, and instead of entering the coordinates in the coordinates window, you will be shouting them out loud in the chat, so make sure the game is not minimized, which does not mean it has to be visible on the screen, you can drag it to the side, place another window on top of it etc.


To use the macro, all you need to do is load it in to Blue Eye Macro, Right click the macro and select Edit. Now specify your key bindings and available buffs in the lower left corner (variables) if your character does not have a healing spell, or any of the 5 available buffs, just leave the keys empty, and Blue Eye will automatically ignore the spells that require these keys.

Also make sure to go through the settings in the top of the macro, to specify the file path to your leveling path file, as well as other general settings for the macro.

Before starting the macro for the first time, make sure to Manually open the "Coordinates Assistant" at move the window to the top left corner of the screen, you can then close the dialog again, and start the macro.
The location of the dialog will automatically be remembered by the game, and wont change when you re-launch the game, so you will only need to do this once.
Attachment:
coordinatesAssistant.png



Required variables are:
  • LevelPath (the location of your leveling path txt file, e.g. c:\Perfect World leveling path.txt)
  • AttackKey (the keyboard shortcut for attacking, e.g. {<f2>})
  • LootKey (the keyboard shortcut for picking up loot, e.g. {<f4>})
  • MeditateKey (the keyboard shortcut for meditation, e.g. {<f5>})

All the memory addresses have been found using Cheat Engine, and all of them are saved as variables in the top of the macro, this makes it easier to "upgrade" the macro to use new memory addresses, in case they change with a future update of the game client.

The latest version of the macro can be downloaded directly from the repository.

Here is the complete (and massive) code for it
Code:
Code:
 begin
     //
     // For help using/configuring this bot, please refer to http://www.blueeye-macro.com/viewtopic.php?f=269&t=885
     //
     // Note: Make sure to ALWAYS set the location of the "Coordinates Assistant" to the top left corner before starting the macro!
     // The location of the dialog will be remembered the next time you start the game, so you just need to do this once
     //
     // USER CONFIGURATION START
     //
     // Key bindings: Set your key bindings in the lower left corner variables
     // Example: To set a keybinding to the F1-Key, enter: {<F1>}
     // Example: To set a keybinding to the numeric 1-key, enter: 1
     //
     // The filepath to your leveling paths file e.g. c:\leveling path.txt (See/share examples of this file at http://www.blueeye-macro.com)
     Variable.Set("LevelPath", "c:\Perfect World Path.txt")
     // If you die this many times, the macro will automatically abort
     Variable.Set("StopMacroIfDeadTimes", "3")
     // Only run the macro for the following amount of minutes (How long does your armor and weapon durability last? (if you care))
     Variable.Set("WarpToTownAndStopMacroAfterMinutes", "120")
     // How often (in %) should a a single pre-attack spell be cast, before finishing off the monster with your primary attack (Good for a slowing spell)
     Variable.Set("PreAttackPercentage", "90")
     // How often (in %) should a human-like pause be inserted between monsters? (Makes you appear less bot-like)
     Variable.Set("HumanPausePercentage", "5")
     // At which percentage of your full HP / MP should meditation begin (Set HP to 0 if you dont want to use meditation for HP regen (if you have healing spell))
     Variable.Set("MeditateAtHPPercentage", "40")
     Variable.Set("MeditateAtMPPercentage", "30")
     // Between each monster, use healing spell if your HP gets bellow this percentage
     Variable.Set("UseHealingSpellAtHPPercentage", "85")
     // If you have a healing spell, how long does it take to cast? (in ms. 1000 ms = 1 sec. 1500 ms = 1,5 sec etc.)
     Variable.Set("HealingSpellCastTime", "1000")
     // During fights, at which HP / MP percentage should potions be used
     Variable.Set("UseHealthPotionAtHPPercentage", "35")
     Variable.Set("UseManaPotionAtMPPercentage", "70")
     //
     // USER CONFIGURATION END
     //
     // Static configuration
     Variable.Set("processName", "elementclient")
     Variable.Set("windowName", "Element Client")
     // Store memory addresses / window name in variables, to make it easier to update if the memory addresses change with a game update
     Variable.Set("maxHPMemoryAddress", "elementclient.exe+65BFCC,20,4b4")
     Variable.Set("maxMPMemoryAddress", "elementclient.exe+65BFCC,20,4b8")
     Variable.Set("currentHPMemoryAddress", "elementclient.exe+65BFCC,20,474")
     Variable.Set("currentMPMemoryAddress", "elementclient.exe+65BFCC,20,478")
     Variable.Set("currentLevelMemoryAddress", "elementclient.exe+65BFCC,20,46c")
     Variable.Set("currentLocationXMemoryAddress", "elementclient.exe+65bfcc,20,384,3c")
     Variable.Set("currentLocationYMemoryAddress", "elementclient.exe+65bfcc,20,384,44")
     Variable.Set("currentLocationHeightMemoryAddress", "elementclient.exe+65bfcc,20,384,40")
     Variable.Set("hasTargetMemoryAddress", "elementclient.exe+65BFCC,20,1088,38")
     Variable.Set("topMostDialogLocationXMemoryAddress", "elementclient.exe+0065BFCC,4,8,70,98")
     Variable.Set("topMostDialogLocationYMemoryAddress", "elementclient.exe+0065BFCC,4,8,70,9c")
     Variable.Set("deathDialogLocationXMemoryAddress", "elementclient.exe+0065BFCC,4,8,4a0,98")
     Variable.Set("deathDialogLocationYMemoryAddress", "elementclient.exe+0065BFCC,4,8,4a0,9c")
     Variable.Set("reachDestinationCheckBoxMemoryAddress", "elementclient.exe+65BFE4,270,2bc,1f0,119")
     Variable.Set("windowActiveMemoryAddress", "elementclient.exe+65B90C,48c")
     // Adjust variables
     Variable.Set("deathCount", "0")
     Variable.Set("killCount", "0")
     Variable.Add (Math)("HealingSpellCastTime", "750")
     // Convert minutes into milliseconds
     Variable.Multiply (Math)("WarpToTownAndStopMacroAfterMinutes", "60000")
     // Make sure the required key bindings have been set
     Function.Execute("Check keybindings")
     // Make sure the window doesnt freeze when it looses focus (to support playing with the game minimized and without focus)
     Memory.Freeze value("{processName}", "{windowActiveMemoryAddress}", "4", "1")
     // Make sure to reset targets when starting the bot by pressing escape
     Window.Send keys("{windowName}", "yes", "0", "{<esc>}")
     Macro.Pause("750")
     if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
          begin
               Window.Display message box("Please make sure you dont have an npc targeted when starting the Macro! the Macro will now exit", "no")
               Macro.Abort()
          end
     // Activate our buffs before starting, and start the stop watches, keeping track of the buff durations
     Function.Execute("Init buffs")
     begin loop()
          Function.Execute("Output status")
          Function.Execute("Use potions")
          Function.Execute("Ensure buffs are still active")
          Function.Execute("Release corpse, heal and fly back if dead")
          Function.Execute with timeout("Ensure within specified hunting ground", "300000")
          Function.Execute("Output status")
          Function.Execute("Release corpse, heal and fly back if dead")
          Function.Execute("Perform healing if required")
          Function.Execute("Output status")
          Function.Execute with timeout("Get target", "2500")
          if  Function.Did not timeout("Get target")
               begin
                    Function.Execute("Release corpse, heal and fly back if dead")
                    Function.Execute with timeout("Kill target", "60000")
                    Function.Execute("Perform healing if required")
                    if  Function.Did timeout("Kill target")
                         begin
                              // If the target does not die within 1 minute, the monster probably cant get to us, so it cant die, select a new target
                              Window.Send keys("{windowName}", "yes", "0", "{targetKey}")
                              Macro.Pause("250")
                              Function.Execute with timeout("Kill target", "60000")
                              Function.Execute("Perform healing if required")
                         end
               end
          Function.Execute with timeout("Get loot", "10000")
          Function.Execute("Output status")
          Function.Execute("Release corpse, heal and fly back if dead")
          Function.Execute("Output status")
          Function.Execute("Meditate if required")
          Function.Execute("Simulate human pause")
          if  Macro.Execution time has exceeded("{WarpToTownAndStopMacroAfterMinutes}")
               begin
                    Window.Send keys("{windowName}", "yes", "0", "{<esc>}")
                    Macro.Pause("1000")
                    Window.Send keys("{windowName}", "yes", "0", "{TownPortalKey}")
                    Macro.Pause("500")
                    Macro.Abort()
               end
     end
 end

function("Simulate human pause")
     if  Randomizer.Maybe("{HumanPausePercentage}")
          begin
               Variable.Set random number("pauseTimes", "5", "15")
               begin loop("{pauseTimes}")
                    Macro.Pause("500")
                    // If we are attacked, abort human pause to be able to defend ourselves first
                    if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
                         begin
                              Function.Abort()
                         end
               end
          end
function

function("Use potions")
     if  Variable.Is not empty("HealthPotionKey")
          begin
               Function.Execute("Calculate current HP percentage")
               if  Variable.Is less than (Math)("currentHPpercentage", "{UseHealthPotionAtHPPercentage}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{HealthPotionKey}")
                    end
          end
     if  Variable.Is not empty("ManaPotionKey")
          begin
               Function.Execute("Calculate current MP percentage")
               if  Variable.Is less than (Math)("currentMPpercentage", "{UseManaPotionAtMPPercentage}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{ManaPotionKey}")
                    end
          end
function

function("Check keybindings")
     if  Variable.Is empty("AttackKey")
          or
          Variable.Is empty("LootKey")
          or
          Variable.Is empty("MeditateKey")
          or
          Variable.Is empty("TownPortalKey")
          or
          Variable.Is empty("TargetKey")
          begin
               Window.Display message box("Please 'Right click' --> 'Edit Macro' and make sure to specify key bindings for at least: Target, Attack, Loot, Town portal and Meditation", "no")
               Macro.Abort()
          end
function

function("Init buffs")
     if  Variable.Is not empty("Buff1Key")
          and
          Variable.Is not empty("Buff1Duration")
          begin
               Window.Send keys("{windowName}", "yes", "0", "{Buff1Key}")
               if  Variable.Is less than (Math)("Buff1Duration", "1000")
                    begin
                         // Convert the duration from minutes to milliseconds
                         Variable.Evaluate (Math)("({Buff1Duration}*60)*1000", "Buff1Duration")
                    end
               Macro.Restart stopwatch("Buff1Watch")
               Macro.Pause("2000")
          end
     if  Variable.Is not empty("Buff2Key")
          and
          Variable.Is not empty("Buff2Duration")
          begin
               Window.Send keys("{windowName}", "yes", "0", "{Buff2Key}")
               if  Variable.Is less than (Math)("Buff2Duration", "1000")
                    begin
                         Variable.Evaluate (Math)("({Buff2Duration}*60)*1000", "Buff2Duration")
                    end
               Macro.Restart stopwatch("Buff2Watch")
               Macro.Pause("2000")
          end
     if  Variable.Is not empty("Buff3Key")
          and
          Variable.Is not empty("Buff3Duration")
          begin
               Window.Send keys("{windowName}", "yes", "0", "{Buff3Key}")
               if  Variable.Is less than (Math)("Buff3Duration", "1000")
                    begin
                         Variable.Evaluate (Math)("({Buff3Duration}*60)*1000", "Buff3Duration")
                    end
               Macro.Restart stopwatch("Buff3Watch")
               Macro.Pause("2000")
          end
     if  Variable.Is not empty("Buff4Key")
          and
          Variable.Is not empty("Buff4Duration")
          begin
               Window.Send keys("{windowName}", "yes", "0", "{Buff4Key}")
               if  Variable.Is less than (Math)("Buff4Duration", "1000")
                    begin
                         Variable.Evaluate (Math)("({Buff4Duration}*60)*1000", "Buff4Duration")
                    end
               Macro.Restart stopwatch("Buff4Watch")
               Macro.Pause("2000")
          end
     if  Variable.Is not empty("Buff5Key")
          and
          Variable.Is not empty("Buff5Duration")
          begin
               Window.Send keys("{windowName}", "yes", "0", "{Buff5Key}")
               if  Variable.Is less than (Math)("Buff5Duration", "1000")
                    begin
                         Variable.Evaluate (Math)("({Buff5Duration}*60)*1000", "Buff5Duration")
                    end
               Macro.Restart stopwatch("Buff5Watch")
               Macro.Pause("2000")
          end
function

function("Ensure buffs are still active")
     // If we are attacked, abort to be able to defend ourselves first
     if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
          begin
               Function.Abort()
          end
     if  Macro.Stopwatch exists("Buff1Watch")
          begin
               Macro.Read stopwatch("Buff1Watch", "buff1Time")
               if  Variable.Is greater than (Math)("buff1Time", "{Buff1Duration}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{Buff1Key}")
                         Macro.Restart stopwatch("Buff1Watch")
                         Macro.Pause("2000")
                    end
          end
     if  Macro.Stopwatch exists("Buff2Watch")
          begin
               Macro.Read stopwatch("Buff2Watch", "buff2Time")
               if  Variable.Is greater than (Math)("buff2Time", "{Buff2Duration}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{Buff2Key}")
                         Macro.Restart stopwatch("Buff2Watch")
                         Macro.Pause("2000")
                    end
          end
     if  Macro.Stopwatch exists("Buff3Watch")
          begin
               Macro.Read stopwatch("Buff3Watch", "buff3Time")
               if  Variable.Is greater than (Math)("buff3Time", "{Buff3Duration}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{Buff3Key}")
                         Macro.Restart stopwatch("Buff3Watch")
                         Macro.Pause("2000")
                    end
          end
     if  Macro.Stopwatch exists("Buff4Watch")
          begin
               Macro.Read stopwatch("Buff4Watch", "buff4Time")
               if  Variable.Is greater than (Math)("buff4Time", "{Buff4Duration}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{Buff4Key}")
                         Macro.Restart stopwatch("Buff4Watch")
                         Macro.Pause("2000")
                    end
          end
     if  Macro.Stopwatch exists("Buff5Watch")
          begin
               Macro.Read stopwatch("Buff5Watch", "buff5Time")
               if  Variable.Is greater than (Math)("buff5Time", "{Buff5Duration}")
                    begin
                         Window.Send keys("{windowName}", "yes", "0", "{Buff5Key}")
                         Macro.Restart stopwatch("Buff5Watch")
                         Macro.Pause("2000")
                    end
          end
function

function("Output status")
     begin
          Memory.Get value("{processName}", "{currentLevelMemoryAddress}", "4", "outputLvl")
          Memory.Get value("{processName}", "{currentHPMemoryAddress}", "4", "outputHP")
          Memory.Get value("{processName}", "{currentMPMemoryAddress}", "4", "outputMP")
          Variable.Evaluate (Text)("Level: {outputLvl}, Kills: {killCount}, Deaths: {deathCount}, HP: {outputHP}, MP: {outputMP}", "statusOutput")
          Macro.Report progress("{statusOutput}")
     end
function

function("Calculate current HP percentage")
     begin
          Memory.Get value("{processName}", "{currentHPMemoryAddress}", "4", "currentHP")
          Memory.Get value("{processName}", "{maxHPMemoryAddress}", "4", "maxHP")
          Variable.Evaluate (Math)("({currentHP}/{maxHP})*100", "currentHPpercentage")
     end
function

function("Calculate current MP percentage")
     begin
          Memory.Get value("{processName}", "{currentMPMemoryAddress}", "4", "currentMP")
          Memory.Get value("{processName}", "{maxMPMemoryAddress}", "4", "maxMP")
          Variable.Evaluate (Math)("({currentMP}/{maxMP})*100", "currentMPpercentage")
     end
function

function("Meditate if required")
     // If we are attacked, abort to be able to defend ourselves
     if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
          begin
               Function.Abort()
          end
     begin
          Function.Execute("Calculate current HP percentage")
          Function.Execute("Calculate current MP percentage")
     end
     if  Variable.Is less than (Math)("currentHPpercentage", "{MeditateAtHPPercentage}")
          or
          Variable.Is less than (Math)("currentMPpercentage", "{MeditateAtMPPercentage}")
          begin
               Window.Send keys("{windowName}", "yes", "0", "{MeditateKey}")
               begin loop()
                    Macro.Pause("750")
                    Function.Execute("Output status")
                    Memory.Get value("{processName}", "{currentHPMemoryAddress}", "4", "hpCheckCurrent")
                    // If we are attacked, or at 100% HP / MP then abort meditation
                    if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
                         or
                         Memory.Value is("{processName}", "{currentHPMemoryAddress}", "4", "{maxHP}")
                         and
                         Memory.Value is("{processName}", "{currentMPMemoryAddress}", "4", "{maxMP}")
                         begin
                              Window.Send keys("{windowName}", "yes", "0", "{MeditateKey}")
                              Macro.Pause("1000")
                              Window.Send keys("{windowName}", "yes", "0", "{LootKey}")
                              Function.Abort()
                         end
               end
          end
function

function("Perform healing if required")
     // If we specified a key for the spell "Iron heart" (or another healing spell)
     if  Variable.Is not empty("HealingKey")
          begin
               Function.Execute("Calculate current HP percentage")
               if  Variable.Is less than (Math)("currentHPpercentage", "{UseHealingSpellAtHPPercentage}")
                    begin
                         Macro.Pause("250")
                         Window.Send keys("{windowName}", "yes", "0", "{HealingKey}")
                         Macro.Pause("{HealingSpellCastTime}")
                    end
          end
function

function("Release corpse, heal and fly back if dead")
     if  Memory.Value is("{processName}", "{currentHPMemoryAddress}", "4", "0")
          begin
               Variable.Increment (Math)("deathCount")
               // Move the "You are dead" box to coordinate 0,0
               Memory.Set value("{processName}", "{deathDialogLocationXMemoryAddress}", "4", "0")
               Memory.Set value("{processName}", "{deathDialogLocationYMemoryAddress}", "4", "0")
               Macro.Pause("1000")
               // Click "Release corpse"
               Window.Send mouse click("{windowName}", "yes", "0", "125", "71", "left")
               Macro.Pause("10000")
               if  Variable.Is equal to("deathCount", "{StopMacroIfDeadTimes}")
                    begin
                         Variable.Evaluate (Text)("The bot was aborted because you died {deathCount} times", "output")
                         Window.Display message box("{output}", "no")
                         Macro.Abort()
                    end
               Function.Execute("Use potions")
               Function.Execute("Meditate if required")
               Macro.Pause("1000")
               Function.Execute("Init buffs")
               Function.Execute with timeout("Ensure within specified hunting ground", "300000")
          end
function

function("Get target")
     begin loop()
          if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
               begin
                    // If we already have a target, abort
                    Function.Abort()
               end
          Window.Send keys("{windowName}", "yes", "0", "{TargetKey}")
          Macro.Pause("250")
          Function.Execute("Use potions")
     end
function

function("Get loot")
     begin
          Function.Execute("Get player location")
          Variable.Evaluate (Text)("{x}{y}{z}", "locationHash")
          Macro.Pause("200")
          // If we are being attacked, dont waste any time picking up drops
          if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
               begin
                    Function.Abort()
               end
          begin loop()
               begin loop("8")
                    Window.Send keys("{windowName}", "yes", "0", "{LootKey}")
                    Macro.Pause("200")
               end
               Function.Execute("Use potions")
               Function.Execute("Get player location")
               Variable.Evaluate (Text)("{x}{y}{z}", "newLocationHash")
               if  Variable.Is equal to("locationHash", "{newLocationHash}")
                    or
                    Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
                    begin
                         // Abort if we finished picking up drops (stopped moving), or if we are under attack.
                         Function.Abort()
                    end
               Variable.Set("locationHash", "{newLocationHash}")
          end
     end
function

function("Kill target")
     if  Variable.Is not empty("PreAttackKey")
          and
          Randomizer.Maybe("{PreAttackPercentage}")
          begin
               Function.Execute("Get player location")
               Variable.Evaluate (Text)("{x}{y}{z}", "locationHash")
               Window.Send keys("{windowName}", "yes", "0", "{PreAttackKey}")
               Macro.Pause("750")
               Function.Execute("Get player location")
               Variable.Evaluate (Text)("{x}{y}{z}", "newLocationHash")
               if  Variable.Is not equal to("locationHash", "{newLocationHash}")
                    begin loop("7")
                         // If we had to move to get close enough to our target, wait a bit while casting the PreAttack spell
                         Variable.Set("locationHash", "{newLocationHash}")
                         Macro.Pause("750")
                         Function.Execute("Get player location")
                         Variable.Evaluate (Text)("{x}{y}{z}", "newLocationHash")
                         if  Variable.Is equal to("locationHash", "{newLocationHash}")
                              begin
                                   Macro.Break from loop()
                              end
                    end
          end
     begin loop()
          Window.Send keys("{windowName}", "yes", "0", "{AttackKey}")
          Macro.Pause("40")
          Function.Execute("Use potions")
          Macro.Pause("40")
          // If our target is dead or we died ourselves, stop attacking
          if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "0")
               or
               Memory.Value is("{processName}", "{currentHPMemoryAddress}", "4", "0")
               begin
                    Variable.Increment (Math)("killCount")
                    // Quickly press esc to avoid wasting MP on a monster that is already dead.
                    Window.Send keys("{windowName}", "yes", "0", "{<esc>}")
                    Macro.Pause("100")
                    Function.Abort()
               end
     end
function

function("Ensure within specified hunting ground")
     // If we are attacked, abort to be able to defend ourselves before flying anywhere
     if  Memory.Value is("{processName}", "{hasTargetMemoryAddress}", "1", "1")
          begin
               Function.Abort()
          end
     begin
          Function.Execute("Get desired location")
          Function.Execute("Get player location")
          Variable.Evaluate (Math)("{x} - {desiredX}", "rangeX")
          if  Variable.Is less than (Math)("rangeX", "0")
               begin
                    Variable.Multiply (Math)("rangeX", "-1")
               end
          Variable.Evaluate (Math)("{y} - {desiredY}", "rangeY")
          if  Variable.Is less than (Math)("rangeY", "0")
               begin
                    Variable.Multiply (Math)("rangeY", "-1")
               end
          if  Variable.Is less than (Math)("rangeX", "{desiredRange}")
               and
               Variable.Is less than (Math)("rangeY", "{desiredRange}")
               begin
                    // If we are already within the specified range of our prefered hunting ground, dont go anywhere
                    Function.Abort()
               end
          Variable.Evaluate (Text)("{desiredX} {desiredY}", "location")
          Window.Get size("{windowName}", "yes", "width", "unused")
          Variable.Subtract (Math)("width", "35")
          // If we are able to fly, activate wings, to help avoiding getting stuck
          if  Variable.Is not empty("FlyKey")
               begin
                    Window.Send keys("{windowName}", "yes", "0", "{FlyKey}")
               end
          Macro.Pause("50")
          // Open the Path dialog
          Window.Send mouse click("{windowName}", "yes", "0", "{width}", "110", "left")
          Macro.Pause("750")
          Window.Send mouse click("{windowName}", "yes", "0", "293", "381", "left")
          Macro.Pause("250")
          Window.Send keys("{windowName}", "yes", "0", "{<enter>}")
          Macro.Pause("250")
          Window.Send mouse click("{windowName}", "yes", "0", "270", "40", "left")
          Macro.Pause("250")
          begin loop("25")
               // Delete whatever has already been entered
               Window.Send keys("{windowName}", "yes", "0", "{<backspace>}")
               Macro.Pause("5")
          end
          Window.Send keys("{windowName}", "yes", "0", "{location}")
          Macro.Pause("50")
          Window.Send keys("{windowName}", "yes", "0", "{<enter>}")
          Macro.Pause("200")
          Window.Send keys("{windowName}", "yes", "0", "{location}")
          Macro.Pause("50")
          Window.Send keys("{windowName}", "yes", "0", "{<enter>}")
          Macro.Pause("200")
          Window.Send mouse double click("{windowName}", "yes", "0", "250", "60", "left")
          Macro.Pause("250")
          // Make sure the Auto-Path-Height box is located at coordinate 0,0
          Memory.Set value("{processName}", "{topMostDialogLocationXMemoryAddress}", "4", "0")
          Memory.Set value("{processName}", "{topMostDialogLocationYMemoryAddress}", "4", "0")
          // Enable "Reach Destination"
          Memory.Set value("{processName}", "{reachDestinationCheckBoxMemoryAddress}", "1", "1")
          Macro.Pause("25")
          Window.Send mouse click("{windowName}", "yes", "0", "145", "43", "left")
          Macro.Pause("150")
          begin loop("15")
               // Delete whatever "Height" previously entered
               Window.Send keys("{windowName}", "yes", "0", "{<backspace>}")
               Macro.Pause("5")
          end
          Window.Send keys("{windowName}", "yes", "0", "{desiredHeight}")
          Macro.Pause("50")
          Window.Send mouse click("{windowName}", "yes", "0", "108", "106", "left")
          Variable.Set("locationHash", "0")
          begin loop()
               // Wait for our character to stop moving, meaning we reached our destination
               Macro.Pause("2500")
               Function.Execute("Get player location")
               Variable.Evaluate (Text)("{x}{y}{z}", "newLocationHash")
               if  Variable.Is equal to("locationHash", "{newLocationHash}")
                    begin
                         // if the location "hash" is unchanged, meaning we reached our destination, close the Path window
                         Window.Send mouse click("{windowName}", "yes", "0", "108", "106", "left")
                         Macro.Pause("250")
                         Window.Send keys("{windowName}", "yes", "0", "{<esc>}")
                         Macro.Pause("250")
                         Function.Abort()
                    end
               Variable.Set("locationHash", "{newLocationHash}")
          end
     end
function

function("Get desired location")
     // If this is the first run, we will load the hunting ground paths in to memory
     if  Variable.Does not exist("paths")
          begin
               File.Read text("{LevelPath}", "paths")
               if  Variable.Does not exist("paths")
                    begin
                         Variable.Evaluate (Text)("A level path file was not found at {LevelPath}, the macro will now quit (for help please visit http://www.blueeye-macro.com)", "errorOutput")
                         Window.Display message box("{errorOutput}", "no")
                         Macro.Abort()
                    end
               Variable.Extract partial text (Regex)("paths", "(?s)-{25,}(.*)", "1", "paths")
               if  Variable.Is not match (Regex)("paths", ":1:(?: [0-9]+){4}")
                    begin
                         Variable.Evaluate (Text)("A level path file was found, but it does not contain a leveling path for at least level 1. The macro will now quit, for help please visit http://www.blueeye-macro.com)", "errorOutput")
                         Window.Display message box("{errorOutput}", "no")
                         Macro.Abort()
                    end
          end
     begin
          // Find the area coordinate that applies to our current level (or go with the nearest level path lower than our current level)
          Memory.Get value("{processName}", "{currentLevelMemoryAddress}", "4", "lvl")
          begin loop()
               Variable.Evaluate (Text)(":{lvl}: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)", "pattern")
               if  Variable.Is match (Regex)("paths", "{pattern}")
                    begin
                         Macro.Break from loop()
                    end
               Variable.Decrement (Math)("lvl")
               if  Variable.Is less than (Math)("lvl", "0")
                    begin
                         Window.Display message box("Failed determining the leveling path for your level", "no")
                         Macro.Abort()
                    end
          end
          Variable.Extract partial text (Regex)("paths", "{pattern}", "1", "desiredX")
          Variable.Extract partial text (Regex)("paths", "{pattern}", "2", "desiredY")
          Variable.Extract partial text (Regex)("paths", "{pattern}", "3", "desiredHeight")
          Variable.Extract partial text (Regex)("paths", "{pattern}", "4", "desiredRange")
     end
function

function("Get player location")
     begin
          // Get our current location, with all decimals
          Memory.Get value("{processName}", "{currentLocationXMemoryAddress}", "float", "x")
          Variable.Evaluate (Math)("401+({x}/10)", "x")
          Memory.Get value("{processName}", "{currentLocationYMemoryAddress}", "float", "y")
          Variable.Evaluate (Math)("551+({y}/10)", "y")
          Memory.Get value("{processName}", "{currentLocationHeightMemoryAddress}", "float", "z")
          Variable.Divide (Math)("z", "10")
     end
function


Download:
Keep in mind the macro requires the predefined variables located in the lower left corner of the designer, so I suggest downloading the macro from the repository, instead of copy pasting the above code.

I would very much appreciate any feedback / ideas for improvements from you guys.

Testing:
When I tested the bot, I went from level 1 to level 31 in a couple of days, leaving my computer on overnight.
I should also mention this bot was created / tested using a character of the class "Cleric" (Winged Elf), but I believe the bot will work just fine with other classes as well, but this have not been tested.

Warning:
The use of any 3d party tool like Blue Eye Macro to play your character on any official Perfect World server, is likely to be considdered a violation of the games regulations.
It is solely your responsibility to ensure no such regulations are violated - or use at your own risk.

Credits:
A big thanks to Martin for helping out with the tasks of locating base pointers and development of the macro.

aw.... its so hard for me :|


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 92 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10  Next

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group