Author |
Message |
|
|
Post subject: |
Re: Timeouts |
|
|
Remember, you can edit this line: Code: if Variable.Is greater than (Math)("Switch Enemies", "14999") //Edit the "14999" of your liking, keep in mind that 1 second = 1000 ms. You can try to type '5000' instead if your character can kill a lot faster. If that works fine with no problems, you can perhaps notch it down to '4500'.
Remember, you can edit this line:
[code]if Variable.Is greater than (Math)("Switch Enemies", "14999") //Edit the "14999" of your liking, keep in mind that 1 second = 1000 ms.[/code]
You can try to type '5000' instead if your character can kill a lot faster. If that works fine with no problems, you can perhaps notch it down to '4500'.
|
|
|
|
Posted: Tue Sep 27, 2011 1:14 pm |
|
|
|
|
|
Post subject: |
Re: Timeouts |
|
|
Thank you. but it is waiting 15 sec to switch enemies even when it is already dead.
Thank you. but it is waiting 15 sec to switch enemies even when it is already dead.
|
|
|
|
Posted: Tue Sep 27, 2011 1:10 pm |
|
|
|
|
|
Post subject: |
Re: Timeouts |
|
|
A small correction, to see how long has passed since the stop watch was started, you first need to read the stopwatch value using Macro.Read stopwatch, like this: Code: begin if Color.At coordinate is within (RGB range)("113", "129", "44", "0", "529", "663") begin Keyboard.Press key("{<tab>}") Macro.Pause("300") Macro.Start stopwatch("Switch Enemies") begin loop() Keyboard.Press key("{<f1>}") Macro.Pause("320") Macro.Read stopwatch("Switch Enemies", "time") if Variable.Is greater than (Math)("time", "14999") begin Macro.Reset stopwatch("Switch Enemies") Macro.Stop stopwatch("Switch Enemies") Macro.Break from loop("no") end end end end
A small correction, to see how long has passed since the stop watch was started, you first need to read the stopwatch value using Macro.Read stopwatch, like this:
[code] begin if Color.At coordinate is within (RGB range)("113", "129", "44", "0", "529", "663") begin Keyboard.Press key("{<tab>}") Macro.Pause("300") Macro.Start stopwatch("Switch Enemies") begin loop() Keyboard.Press key("{<f1>}") Macro.Pause("320") Macro.Read stopwatch("Switch Enemies", "time") if Variable.Is greater than (Math)("time", "14999") begin Macro.Reset stopwatch("Switch Enemies") Macro.Stop stopwatch("Switch Enemies") Macro.Break from loop("no") end end end end [/code]
|
|
|
|
Posted: Sun Sep 25, 2011 9:24 am |
|
|
|
|
|
Post subject: |
Re: Timeouts |
|
|
Nice first attempt, it's just sometimes knowledge is power and the more you know about certain functions, the better. And that knowledge will be brought now~ (Ah, a little note: you can use the [.code][/code] feature (without the period) to wrap your code around.) Concerning time, there's a command called Macro.Start stopwatch() that essentially lets you create a timer. Then we'll 'Read the stopwatch' and compare it to an if statement to see if the time exceeds 15 seconds (This function uses the unit 'ms' miliseconds, so 1 second = 1000 ms). The important part is that we need the timer to stop and reset itself so that way it'll only count for those 15 seconds the moment it finds another enemy to target on. Here's a small example: Code: Macro.Start stopwatch("Switch Enemies") begin loop() Macro.Read stopwatch("Switch Enemies", "time") if Variable.Is greater than (Math)("time", "14999") begin Macro.Reset stopwatch("Switch Enemies") Macro.Stop stopwatch("Switch Enemies") Macro.Break from loop("no") end end
The Macro.Break from loop "no" signifies to break the loop immediately. If you want this to loop infinity until you want it to stop, there's a tickmark you can check called 'Infinite' under loops. You can click on that and your entire macro will loop regardless. Make sure under 'Trigger' that you actually set up a hotkey to stop your macro (I recommend Ctrl+A). I'll go under the assumption that 'tab' is to switch enemies, and to make this macro efficient, you already got one pixel detection that essentially activates the whole macro, so we'll leave the beginning part alone, and get rid of the second pixel detection. Here's a revised code I came up with on the fly, let me know what you think and report back. You may edit this particular line if you choose to edit the amount of seconds: Code: if Variable.Is greater than (Math)("Switch Enemies", "14999") //Edit the "14999" of your liking, keep in mind that 1 second = 1000 ms.
Modified code for you (with a bit of Gigus on the side): Code: begin if Color.At coordinate is within (RGB range)("113", "129", "44", "0", "529", "663") begin Keyboard.Press key("{<tab>}") Macro.Pause("300") Macro.Start stopwatch("Switch Enemies") begin loop() Keyboard.Press key("{<f1>}") Macro.Pause("320") Macro.Read stopwatch("Switch Enemies", "time") if Variable.Is greater than (Math)("time", "14999") begin Macro.Reset stopwatch("Switch Enemies") Macro.Stop stopwatch("Switch Enemies") Macro.Break from loop("no") end end end end
Edit: Reflects on Gigus's post. I must of been on a sugar rush typing this out~
Nice first attempt, it's just sometimes knowledge is power and the more you know about certain functions, the better. And that knowledge will be brought now~ (Ah, a little note: you can use the [.code][/code] feature (without the period) to wrap your code around.)
Concerning time, there's a command called Macro.Start stopwatch() that essentially lets you create a timer. [b]Then we'll 'Read the stopwatch' and compare it to an if statement to see if the time exceeds 15 seconds[/b] (This function uses the unit 'ms' miliseconds, so 1 second = 1000 ms). The important part is that we need the timer to stop and reset itself so that way it'll only count for those 15 seconds the moment it finds another enemy to target on.
Here's a small example:
[code] Macro.Start stopwatch("Switch Enemies") begin loop() Macro.Read stopwatch("Switch Enemies", "time") if Variable.Is greater than (Math)("time", "14999") begin Macro.Reset stopwatch("Switch Enemies") Macro.Stop stopwatch("Switch Enemies") Macro.Break from loop("no") end end [/code]
The Macro.Break from loop "no" signifies to break the loop immediately. If you want this to loop infinity until you want it to stop, there's a tickmark you can check called 'Infinite' under loops. You can click on that and your entire macro will loop regardless. Make sure under 'Trigger' that you actually set up a hotkey to stop your macro (I recommend Ctrl+A).
I'll go under the assumption that 'tab' is to switch enemies, and to make this macro efficient, you already got one pixel detection that essentially activates the whole macro, so we'll leave the beginning part alone, and get rid of the second pixel detection. Here's a revised code I came up with on the fly, let me know what you think and report back. You may edit this particular line if you choose to edit the amount of seconds:
[code] if Variable.Is greater than (Math)("Switch Enemies", "14999") //Edit the "14999" of your liking, keep in mind that 1 second = 1000 ms. [/code]
Modified code for you (with a bit of Gigus on the side):
[code] begin if Color.At coordinate is within (RGB range)("113", "129", "44", "0", "529", "663") begin Keyboard.Press key("{<tab>}") Macro.Pause("300") Macro.Start stopwatch("Switch Enemies") begin loop() Keyboard.Press key("{<f1>}") Macro.Pause("320") Macro.Read stopwatch("Switch Enemies", "time") if Variable.Is greater than (Math)("time", "14999") begin Macro.Reset stopwatch("Switch Enemies") Macro.Stop stopwatch("Switch Enemies") Macro.Break from loop("no") end end end end [/code]
Edit: Reflects on Gigus's post. I must of been on a sugar rush typing this out~
|
|
|
|
Posted: Sun Sep 25, 2011 3:54 am |
|
|
|
|
|
Post subject: |
Timeouts |
|
|
I dont know nothing yet how to create a macro so don't laught :p i want to it select the mob then attack and when it die select another mob. but sometimes it stuck in walls,tree etc.. so i want to add timeouts. (15 segs) then select another mob. also if someone can improve it i would be happy,thank you. Code: begin if Color.At coordinate is within (RGB range)("113", "129", "44", "0", "529", "663") begin loop("1024") Keyboard.Press key("{<tab>}") Macro.Pause("300") Keyboard.Press key("{<f1>}") Macro.Pause("320") if Color.At coordinate is not within (RGB range)("113", "129", "44", "0", "530", "660") begin Keyboard.Press key("{<f1>}") Macro.Pause("310") end end end
I dont know nothing yet how to create a macro so don't laught :p i want to it select the mob then attack and when it die select another mob. but sometimes it stuck in walls,tree etc.. so i want to add timeouts. (15 segs) then select another mob. also if someone can improve it i would be happy,thank you.
[code]
begin if Color.At coordinate is within (RGB range)("113", "129", "44", "0", "529", "663") begin loop("1024") Keyboard.Press key("{<tab>}") Macro.Pause("300") Keyboard.Press key("{<f1>}") Macro.Pause("320") if Color.At coordinate is not within (RGB range)("113", "129", "44", "0", "530", "660") begin Keyboard.Press key("{<f1>}") Macro.Pause("310") end end end
[/code]
|
|
|
|
Posted: Sun Sep 25, 2011 1:31 am |
|
|
|
|