Sign in to follow this  
Followers 0
steenpat

Bot Help

10 posts in this topic

Hi,

I'm having a problem hunting monsters in this conquer online game with my bot macro. It does what I want it to albeit very simply. The problem is that when I do PixelSerach it finds the monster and clicks the mouse button repeatedly. Now, inside the game it looks real obvious because there is a graphic display that forms around my char(kind of like a ring of energy) every time the spell is initiated. So i'm paranoid that someone will find out i'm using a macro. What I want the program to do is only click the mouse button *once* when it finds a certain creature(the game automatically has the char keep using spells over and over once the mouse button has been clicked once). Also, the other problem is that using PixelSearch my char will attack all monsters on screen at random that have the same pixelsearch values( i.e. not focusing on one specific monster).

I'm pretty newb at scripting because I've just picked it up so my code is very basic. If you can give me some suggestions let me know. I appreciate it.

HotKeySet("^f", "MyExit")

WinActivate("[Conquer]")


   While 1    ; repeat statements over

      ; look for monster and attack him
             $CoordMonster = PixelSearch ( 0,0,800,800,0x6B8200,5 )
             If Not @error Then
             MouseClick ( "Right" , $CoordMonster[0], $CoordMonster[1] , 1,1)        
             EndIf   

; if mana is empty replenish it
          If  PixelGetColor( 55, 744) = (0x737173) Then
             For $i = 3 to $i = 1 Step  -1
                Send("{F2}")    
                Sleep("100")  
                Send("{F3}")
                Sleep("9000")
             Next   
          EndIf   
            
   Wend

Func MyExit()
   Exit
EndFunc

Share this post


Link to post
Share on other sites



It keeps clicking because that is what coded it to do :-)

Find monster, click - Find monster, click - Find monster, click....

Like your comment states:

; repeat statements over

but it is pretty good coding other than that one undesired aspect :-(

One solution would be to split this script into two different scripts:

one that loops and looks for monsters

one the keeps an eye on your mana

the monster script would just end after finding and clicking on one monster

the mana script hangs around until you kill it.

If you do not like that solution and just want to stick to using one script - then wrap the "monster part of the code" in another If and ignore it once a monster has been found.

;partial code for solution one
While 1  ; repeat statements over

  ; look for monster and attack him
   $CoordMonster = PixelSearch ( 0,0,800,800,0x6B8200,5 )
   If Not @error Then
      MouseClick ( "Right" , $CoordMonster[0], $CoordMonster[1] , 1,1)
      Exit; <<<<<<<<<<<end script after one click
   EndIf     
WEnd

;partial code for solution two
$Got_One = "No";<<<<<<<<<<<<added flag

While 1  ; repeat statements over

  ; look for monster and attack him
   If $Got_One = "No" Then;<<<<<<<<<<<<added wrap
      $CoordMonster = PixelSearch ( 0,0,800,800,0x6B8200,5 )
      If Not @error Then
         MouseClick ( "Right" , $CoordMonster[0], $CoordMonster[1] , 1,1)
         $Got_One = "Yes";<<<<<<<<<<set flag
      EndIf
   EndIf;<<<<<<<<<<<<added wrap
;;;;;;;;;;;; rest of your original code
WEnd

Make sense?


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Is there anyway to detect whether the monster is dead? If so why not just pause the clicking until after the monster is dead. Maybe it puts a ring around the monster until it is dead?(sorry i am not familiar with the game) If so just wait till there is not ring around it any more at which time I would assume it would be dead.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

hankjrfan,

I wondered about this approach also, but did not know exactly how to take these two bits of info that steenpat wrote,

"...the char keep using spells over and over once the mouse button has been clicked once..."

and

"not focusing on one specific monster"

The first bit of info: "spells over and over" lead me to think that the script need not click on any other monsters... the character will do them harm via the "constant spells setting" if they come close.

The second bit of info: "not focusing on one specific monster" made me wonder about the wisdom of my suggestion to have the "monster script/code" end.

Other than that small confusion on my part, steenpat gave a good description of the task at hand.

I envisioned the script clicking on one monster which will start the character to casting spells [would this be the same as "start the character to spelling" :-)]. Then the character just stands there "using spells" [spelling] while the other monsters come to near and are are killed via spells [misspelled words] (no further "monster clicking" is required)... The "mana script" keeps the mana level up so that the spells can continue. Just a wild guess. [Edit: bracketed info is just poor 2AM humour]

On the other hand, if the script must click on the other monsters to direct the spells, then obviously my suggestion to have that clicking action stop is no good.

steenpat,

Great first post! Good detail and good code.

If I were a gamer, I might be of more use to you.

(You might want to consider moving the WinActivate line inside the While/WEnd loop... just to make sure that the game stays in focus and one wrong click by some silly human does not mess things up for your bot and game.)

Like hankjrfan said, if the monster changes (or even better goes away) when dead AND if you need the script to click on the next monster of interest, then let us know and we can help you code that. Or you can think about going the two script solution, but instead of having the "monster script" exit. Replace that "Exit" line of code with a "Sleep" statement or another loop that waits for the death of the monster just clicked on.

later

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

First of all thanks for responding to my question.

hankjrfan brings up a very interesting point. It would be very effecitive if I could detect when the monster is dead because then the character should redirect his attack on another monster. I noticed one bug in the script I made: when the monster is dead the program is still searching for the pixel of the monster even when it is dead and on the ground slowly disappearing.

-I tried using the route you mentioned above of the two solutions. I think that is helpful because I need to check when I am in attack mode and when my mana is empty. However, I am stumped right now as to how I code this script into interpreting whether the character is attacking or not and then looping around it properly.

More clearly I can divide these things into certain objectives:

1. Find Monster on screen

a. method of PixelSearch()

b. Other methods?

2. Attack one monster at a time

a. methods?

3. Attack monster till it is out of health

a.methods?

4. If there are no monsters on screen do nothing.

5. If mana is empty stop attacking.

6. Replenish mana

a. method already implemented

7. Loop back

Problems/errors:

1. PixelSearch() finds pixels of every monster and seems to locate the pixels

due to its own implementation. Because of this, the character seems to not focus on one monster at a time.

2. PixelSearch() finds pixels of dead monsters and script ends up causing character to focus attack on already dead monster.

3. Only one mouse button click per monster is needed. Current script uses repeated mouse button clicks. Solution is to find a way to detect whether character is currently attacking. If so, then there is no need for further mouse button clicks.

Other misc problems-

1. PixelSearch is currently coded for a specific monster in the script. If character were to move to a different location where different monsters are script would not function anymore.

-All monsters have a red bar of health above their name which differentiates them from npcs and other players. However, this red health bar is only noticeable while the mouse cursor is positioned over them.

If you guys feel like tackling a problem like this with me, feel free to offer suggestions/advice. I wish I knew the coding solution to these problems but it doesn't seem so obvious to me.

Thanks again.

Share this post


Link to post
Share on other sites

So i'm paranoid that someone will find out i'm using a macro.

Out of all fairness. Hope they find out, kick you out for cheating, and ban you.

Share this post


Link to post
Share on other sites

We are really not discussing that so don't post irrelevant statements.

Share this post


Link to post
Share on other sites

We are really not discussing that so don't post irrelevant statements.

<{POST_SNAPBACK}>

I am only wishing you, what you deserve. If you do not like that. Then do not post this low level stuff.

Share this post


Link to post
Share on other sites

Stop flaming. Keep it to yourself or other forums.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I found an idea that might work for this situation.

I think if I can use PixelCheckSum() to calculate if an area is changing within a certain interval of time then it will be able to determine if the character is in attack mode. If the area is not changing within that interval then the character is not attacking. (i.e. if the mana is decreasing steadily it means that spells are being used). Thus, if the character is attacking then the 2nd solution mentioned above applies and there are no more unnecessary mouse clicks.

This solves one problem. But implementation?

The other problem is the monster situation. Say I go to another area and I shouldn't be using PixelSearch() to look for a certain pixel. What I really need is a universal ID tag that identifies a target as unique monster not just a monster with a specific pixel. Not sure how to do this.

Any thoughts?

-- I solved both problems using PixelSearch() for the monster. And PixelSearch() if the character is attacking.

Now that these problems are over I'm going to try implementing a waypoint system so that the character will move around instead of just sitting there.

Edited by steenpat

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0