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

Need some help on this script

Recommended Posts

So I need to add a condition on the procedure 5 where I need it to wait for 7 minutes till untill the next keypress how can I do this I'm struggling with this.

 

 

 

SetActiveWindow Granado Espada Andromida

procedure 4 // Hp Potion
Keydown @{u}
Keydown @{m}
Keydown @{j}
Keydown @{u}
Keydown @{j}
Keydown @{m}
Keydown @{u}
Keydown @{j}
Keydown @{m}
delay 1 sec
End

procedure 5 // Buff_Pot
Keydown @{i}
delay 1 sec
End

while 1 = 1
call 4
call 5

end

Share this post


Link to post
Share on other sites

okay, I am not quite following you as what you are wanting to do. But, to do a 7 minute delay. you need to look at the Delay command and the DelayUntil command.

 

And in the code you posted above. You are using the Keydown command incorrectly. And from what I can see, I don't believe it is the correct command for what you are trying to do?

 

So, you are going to have to explain, specifically what you are doing with just the code above? Then we will talk about your delay.

Share this post


Link to post
Share on other sites

okay its juts a simple healing potion use script, as the game is a multi character control game I have 3 HP potion slots as you can see on the procedure 4, as for the keydown command I've tried the other commands to send the keys and none of them seem to work  only the keydown command and well this sends us to the last spot in the game I have a buff potion wich duration is 7 minutes so the procedure 5 is to use that potion,  so let just say that I use the code like this:

procedure 5 // Buff_Pot
Keydown @{i}
delay 7 minutes
End

while 1 = 1
call 4
call 5

end

the code would just stop working on the side of the procedure 4 until the 7 minutes delay of procedure 5 end , so what it want is to condition that if the delay of procedure 5 is not over  the procedure 4 keeps working normally till the procedure 5 delay is completed so it can cosume the potion again.

 

Share this post


Link to post
Share on other sites

Again, from what I am seeing. you are still not using KeyDown correctly. And since you have never posted about the Keys command, or any other command, not working with "Granado Espada Andromida". I have to assume, based on your code above, that you were using Keys incorrectly as well. But, I can tell you that using Keys to send the keys to the "Granado Espada Andromida" game works.

 

Command:                                           Description:
Keys                                                       Sends one or more keystrokes to the game/application.
                                                              The same as pressing a key on the keyboard.

KeyDown                                               Presses and then holds down a key for a specific amount of time.
                                                              You give the amount of time to hold down the key, in milliseconds, as
                                                              part of command.

 

 

For what what you have coded above.

KeyDown @{i}

Causes AC Tool to press and then hold down the Alt key, then press and hold down the { key, then press and hold down the i key and then press and hold down the } key. And wait for 0 milliseconds while holding down all those keys. Then it would release the } key, then release the i key then release the { key and finally release the Alt key.

 

And I assume that your use of the Keys command was this,  since you have never made a post showing what you had used that supposedly didn't work:
 

Keys @{i}

This causes AC Tool to press and hold the Alt key, Press and release the { key,  and then release the Alt key. Then it would press the i key. Then it would press  the } key.

 

I am very sure that you are not going and pressing the Alt-{ key, then i key and then the } key to take a potion in the game. So, your using the above key commands wrong. It does not matter what you are doing. Unless you are using any one of the Special Keys listed in the Special Keys page of the Help file. You do not place curly brackets around the keys that you are sending to the game/application.

 

The proper, and only, way to use Keys command to send a key, or set of keys, to the game/application is:

Keys @i

This causes AC Tool to press the Alt key and hold it down, then press the i key, then immediately release the i key and the release the Alt key. Which is exactly what you do when pressing the Alt-i keys.

 

And the proper, and only, way to use the KeyDown command to send keys to the game/application is:

KeyDown @i 10 // This presses and holds down both the Alt key and they i key for 10 milliseconds

This causes AC Tool to press the Alt key and hold it down, the press and hold down the i key, wait 10 milliseconds with both keys being held down. Release the i key, then release the Alt key.

 

If you are not using the Keys command or the KeyDown command as I have shown. Then you are not sending the proper keys to the game/application to do what you need to do.

Share this post


Link to post
Share on other sites

Sorry for the late so, based on what you told me I corrected the code and it looks like this:

 

Procedure 2 // builder/summoner 2
keydown x 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown c 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown v 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown z 0.5 sec
end

 

It took me a while to understand what you posted but it works amazing all the keys work as intended and I've removed the alt thing as well as the {}.

 

 

 

Share this post


Link to post
Share on other sites

Okay, the removing of the Alt thing "@" is all an good. But, if you need to press the Alt key while pressing the required key to do what you need to do. Then you do need to add it.

 

Such as the Alt, Ctrl and Shift keys are referred to switch keys. Those are keys that you press and hold down and then press another key to produce a key combination.

Example:
Ctrl-A - When pressing the Ctrl-A key combination in your web browser, it will cause everything on the page to be selected.
Shift-1 - Will cause the ! to be typed in Notepad.

And any other combination of the Alt, Ctrl, Shift keys that can be used depending on the game/application running.

To do the switch keys in AC Tool you use the following characters in your Keys, Keydown, etc. commands to represent the switch keys:

@ = Alt
~ = Shift
^ = Ctrl

So, Ctrl-A would be ^a and Shift-1 will be ~1.

 

Now if you need to send to the game/application the '@' or '~' or even the '^' key. Then you need to do the following:

To send @ to the game, use  @@.
To send ~ to the game, use  ~~.
To send ^ to the game, use ^^.

 

Share this post


Link to post
Share on other sites

Now as for your corrected procedure that you posted. Unless you really need to hold down the keys for half a second (.5 seconds). Then all you need to do is use the Keys command instead of the Keydown command.

So, the procedure that you have posted should be:

Procedure 2 // builder/summoner 2
  keys x
  delay 1 sec
  leftclick
  delay 3 sec
  keys c
  delay 1 sec
  leftclick
  delay 3 sec
  keys v
  delay 1 sec
  leftclick
  delay 3 sec
  keys z
end 

 

Now, if for some reason the above does not seem to work right. Then the game may not be recognizing that they keys are being pressed. Just let me know, along with your current and complete script, and I'll help you then.

 

I would also recommend that you change the procedure name from using the number 2 to a word, or set of words, that states what the procedure does.

For example, if this procedure is to heal a character then the procedure name should be as the following:

Procedure HealSummoner // builder/summoner 2
  keys x
  delay 1 sec
  leftclick
  delay 3 sec
  keys c
  delay 1 sec
  leftclick
  delay 3 sec
  keys v
  delay 1 sec
  leftclick
  delay 3 sec
  keys z
end 


Or it can be:


Procedure Heal_Summoner // builder/summoner 2
  keys x
  delay 1 sec
  leftclick
  delay 3 sec
  keys c
  delay 1 sec
  leftclick
  delay 3 sec
  keys v
  delay 1 sec
  leftclick
  delay 3 sec
  keys z
end

 

I hope that you understand what I am trying to say here.

Share this post


Link to post
Share on other sites

Okay so my full code looks like this:
 

SetActiveWindow Granado Espada Andromida

Procedure 1 //builder/summoner 1
keydown w 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown e 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown r 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown q 0.5 sec
end

Procedure 2 // builder/summoner 2
keydown x 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown c 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown v 0.5 sec
delay 1 sec
leftclick
delay 3 sec
keydown z 0.5 sec
end

procedure 3 //buff
keydown i 0.5 sec
delay 5 min
end

while 1 = 1
call 1
call 2
call 3
end

So I tried using the keys and skeys command to send the keystrokes but for some unknown reason this codes really don't work with the game and the keydown command seems to work surprisingly good with the game, so taking in count all what you told me I've managed to get good results with this new code, but I have a problem with the third procedure that might be the buff skill wich I would need to cast every five minutes but if I leave the code this way it would reach the procedure 3 after the procedure 2 ends but will stay doing nothing until the delay of the procedure 3 finish.But I dont find a way to put a condition where if the delay is not complete the procedures 1 and 2 keep running-

Share this post


Link to post
Share on other sites

You need a delay after setting the active window or the commands race ahead before the game focuses.

 

SetActiveWindow [game name]

Delay 2 sec

does the game call 1, 2 or 3 procedures by themselves or a combination?

 

These 2 commands are what I needed to use some commands in one of the games I play, is the only way to register the keystrokes.

 

keyrate 30 : used to slow the typing of letters in the game screen. I use keyrate 1 after the word has been typed and acted apon.

MouseClickDelay 50 : used as a buffer to slow the mouseclicks.

Share this post


Link to post
Share on other sites
18 hours ago, Ego said:

You need a delay after setting the active window or the commands race ahead before the game focuses.

 

SetActiveWindow [game name]

Delay 2 sec

does the game call 1, 2 or 3 procedures by themselves or a combination?

 

These 2 commands are what I needed to use some commands in one of the games I play, is the only way to register the keystrokes.

 

keyrate 30 : used to slow the typing of letters in the game screen. I use keyrate 1 after the word has been typed and acted apon.

MouseClickDelay 50 : used as a buffer to slow the mouseclicks.

I dont think I uderstande this quesiton "does the game call 1, 2 or 3 procedures by themselves or a combination?" if you ask about the code the procedures 1&2 are called consecutively one after another but the third one must only run once every 5 minutes.

Share this post


Link to post
Share on other sites

Ok, so the script will never call 1 and 2 or 1 and 3 or 3 by its-self, or any combination of the 3 procedures?

Will always call 1 then 2 then 3 every time?

I ask this because the code can be condensed to 1 procedure.

Share this post


Link to post
Share on other sites
56 minutes ago, Ego said:

Ok, so the script will never call 1 and 2 or 1 and 3 or 3 by its-self, or any combination of the 3 procedures?

Will always call 1 then 2 then 3 every time?

I ask this because the code can be condensed to 1 procedure.

Yes thats the idea procedures 1 and 2 will keep running let's assume that I will  combine the procedures 1 and 2 wich is possible, but I still need to run the procedure every 5 minutes without stop calling the other procedure

Share this post


Link to post
Share on other sites

here is a snippet of code from one of my scripts

Look up ProcessMessages, should give you an idea.

MouseClickDelay 50
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Procedure MoveMe Every 5 sec
  call relog
  call checks
End
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
While 1 = 1
  ProcessMessages
  delay 5 min
End

Share this post


Link to post
Share on other sites

so let me understand this:

Procedure MoveMe Every 5 sec
  call relog
  call checks
End

this will call you procedure move me every 5 seconds so my code should look like this?

procedure 3 every 5 min  //pink loli
Keydown i 0.5 sec
delay 4 sec
end

this way when I wall the procedure it will call  thi first time the 3 procedures and the just the first 2 for five minutes right?

So I kind of tried the code MR.Ego share and I think I'm not getting the Idea @Ego would you mind explaning to me how does your code work?

Edited by ArcherRojas
update

Share this post


Link to post
Share on other sites

objvar = 3
MouseClickDelay 50
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
While 1 = 1
  ProcessMessages
End
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Procedure TimeCheck Every 5 sec
  delay $wait sec
  FormatDateTime Time = {now}, h:n
  if $Time = 03:50
    call reboot
  End
End

This is the start of my script, missing the reboot procedure which just reboots the game at 0350, local time, every morning.

So for you, in the timecheck procedure, will be your //pink loli code above.

To run your code, you would put in call 1, call 2, call 3, where call relog and call checks are, BUT, without the 5 minute delay in call 3.

OR condense your code to 1 procedure and use that where my TimeCheck code is.

Hope this script helps. (No idea if it will work in-game as I do not play it)

help.mac

 

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.