Jump to content
AC Tool Forums
Sign in to follow this  
Saab

Trying to make auto mp pot for this game I am trying out

Recommended Posts

First of all, I am new to ACTool and I may be making up some weird nonsense lol.

I am trying to make a loop where it uses potion on slot F4 until mp/mana is filled back up to full. I believe the way I currently have it set up is suppose to press F4 when there is no blue filled up within the MP/Mana bar and press F4 to fill it back up until the command becomes true again. The problem I have is that even after the command becomes true(when the mp bar is full), it keeps on pressing F4. What should I be adding here to make it so it'll stop using mana potions when it's already full?
Currently using AC Tool 5.4.0.

While 1=1

SetActiveWindow PCIK1.5

IsBlue  1352, 536
  // Do these commands if true 
Else
  // Do these commands if false 
  Keys {F4}
End

End

Skyblade.mac

Edited by Saab

Share this post


Link to post
Share on other sites

@Saab after reading your post, and looking at your code. It is a very simple and easy code, but one where a lot of noobs tend to have trouble with.

  1. I would suggest that you place the SetActiveWindow command outside of your while loop. You do not need to constantly set the game's window the active. Just the one time at the beginning of your script is all you need to do.
  2. I would also suggest that you place a Delay command directly after the SetActiveWindow command. The reason for it is to allow the Games's window time to become the active window, be moved to the front of all other windows, and to a tiny amount of time for the graphics to stabilize.  Or if the Game's window is Full screen - to allow to go from minimized to maximized, to display the graphics, and to stabilize. I know, that with today's hardware that should not be needed. But, you find that a lot of scripts tend to fail their Color, Object, checks because a delay was not added. Before continuing on with the rest of the script.

    The amount of a delay between the SetActiveWindow and the rest of your script, Is up to you. But, a good rule of thumb is to have a 2 second delay.

Use the modified version of your script as a bases for your contining edits:

SetActiveWindow PCIK1.5
Delay(2 sec)

While 1=1

  IsBlue  1352, 536
    // Do these commands if true 
  Else
    // Do these commands if false 
    Keys {F4}
  End
End

 

But, now to the problem of your script.

First, I'll describe to you how the script is currently working, with the setactivewindow command placed outside of the while loop:

  1. Enter While loop.
  2. Check to see if 1 = 1 if yes continue to step 3.
  3. Pixel at Coord 1352, 536 is Blue
  4. goto Step 2
  5. Pixel at Coord 1352, 536 is not Blue
  6. press F4 key
  7. goto Step 2

In a nutshell that is what your script is doing. And on the surface this doesn't look wrong.

The way it is coded right now. Steps 2 thru 7 are performed 2 to 3 times per second. There is no time to allow the game to perform the action of drinking a potion. Or to allow the game time to updated it's display before you check the pixel again.

So, in the first 2 seconds, you have just drank 5 potions. And all before knowing if the first potion was enough. And if your games keeps a number of keys that was pressed in a buffer. By the time the script is finally registering that the pixel is Blue and doesn't do anything. The game will continue drinking a potion until the number a keys stored in the buffered run out.

Another reason the script could be using potions, is because it is detecting that the pixel is no longer blue. Even for a fraction of a second. This may be a glitch in the game display, or something totally game related.

 

As I would always suggest for all noobs. Is that you pick a range of between the max and Min amount of Mana/HP.

And use that range to determine if and when you need to use a potion/spell.

  1. So, Check to see if the Mana/HP is maxed.
  2. If the Mana/HP is not Max then is it at lease no less then a certain amount.
  3. If the Mana/HP is not Max but is at lease no less than the certain amount, do nothing.
  4. But, if the Mana/HP is not Max and is less than the certain amount. Then drink a potion, or do a spell.
  5. at this point it is up to you. Either go back to Step 1 or have your code Max out your Mana/HP then go back to Step 1.

But, no matter how you code your script. You have to allow time for the game to perform the action of actually drinking a potion, or doing a spell, and updating the display before you check to see if you are at Max or what ever lever you have set.

 

One last thing that I have to say Is that you have to some form of delay at then end of checking to see if the Mana/HP is Max or not. Take for example your original code. Adding a delay between each check would look like this:

SetActiveWindow PCIK1.5
Delay(2 sec)

While 1=1

  IsBlue  1352, 536
    // Do these commands if true 
  Else
    // Do these commands if false 
    Keys {F4}
  End
  Delay(200)
End

The amount of the delay is up to you, to maximize the drinking of potions when needed. Usually it is no larger than a few hundred milliseconds. But, you have to have some form of delay between one iteration of the loop and then next.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and to our Privacy Policy.