Help - Search - Members - Calendar
Full Version: Reduce lots of calls
AC Tools Everything Macro > AC Tool > AC Tool Discussion
Vanberk
Hello everyone! Im new here and have only used AC Tool for about a day now.

I was doing a macro that would use lots of key presses and I know that you could reduce the size of the macro with procedures.

Here is some parts from the script to make you understand.
CODE
.....
loop 11
call {loopno}

// settings
procedure left using loopX
loop $loopX
keydown {left} 50
delay $speed
end
end

// levels
procedure 1 // level 1
call right 1
call down 2
call right 2
call down 1
call right 1
call wait // level 1 Done
end


Procedure 1 have 6 calls and i got other procedure with more than 30 lines of calls and its big and ugly so i was thinking... can you reduce the calls?

example:
call right 1, down 2, right 2, down 1, right 1, wait
or
call right 1|down 2|right 2|down 1| right 1| wait

hope you understand laugh.gif

-Vanberk
Ahk
Make a list or dataset, then loop through the list or dataset to do what you're already doing.

Either way that information will have to be stored in some fashion in the code...it's just a matter of where and how.
Vanberk
I know how to insert it inside a .inc files, but i was hoping for something else than having loads of call somewhere. sad.gif

Oh well, if someone knows how to make it smaller and not just "hide" it elsewhere, Feel free to post it here laugh.gif
Otherwise, I think I got my answer.

-Vanberk
Ahk
If you made a list/dataset, there would really be only one call for each SET of moves.
Vanberk
okay blink.gif

This is my new level 1:
CODE
procedure 1 // level 1
  ListAdd Key, {right}, {down}, {down}, {right}, {right}, {down}, {right}
  ListCount Key, lcount
  loop $lcount
    keys Key[{LoopNo}]
    delay $speed
  end
  call wait // level 1 Done
end


and i have

CODE
constants
  speed=200 // delay
  lcount=NoValue
end

Constructs
  Key=List
End


I used a TimeStamp after the loop but it only loop once... Isnt it looping lcount = 7 times? o.O
Or should I use Call Key[{LoopNo}] instead? and change the Listadd thing to the Procedure names?

-Vanberk
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.