Help - Search - Members - Calendar
Full Version: 2 commands
AC Tools Everything Macro > AC Tool Macros > Other Macros
darksnow
i am making a macro that i wish to be able to turn on and off.this is the part of the macro i need help with.

CODE
procedure ctbf
While 1 = 1
IF {Globalkeys} contains 50
ClearGlobalKeys
Call Start
Else
Keydown $jump 10
LeftMouseDown
Delay 13
LeftMouseUp
Keydown $block 10
Delay 252
LeftMouseDown
Delay 13
LeftMouseUp
Keydown $block 10
Delay 252
LeftMouseDown
Delay 13
LeftMouseUp
Keydown $block 10
Delay 252
End
End
End


with this code, i can turn the macro on and off by pressing the same key again.
however, i want this macro to work for 2 keys, but if i add another
IF {Globalkeys} contains ##
ClearGlobalKeys

the macro doesn't work and says that a previous procedure needs to finish first.
DaMOB
CODE
procedure ctbf
  While 1 = 1
    IF {Globalkeys} contains 50
      ClearGlobalKeys
      Call Start
    Else
      Keydown $jump 10
      LeftMouseDown
      Delay 13
      LeftMouseUp
      Keydown $block 10
      Delay 252
      LeftMouseDown
      Delay 13
      LeftMouseUp
      Keydown $block 10
      Delay 252
      LeftMouseDown
      Delay 13
      LeftMouseUp
      Keydown $block 10
      Delay 252
    End
  End
End
Bad code is bad. Look here at a potential flaw that will eventually eat up your stack space and crash.

CODE
procedure ctbf
  While 1 = 1
    IF {Globalkeys} contains 50
      ClearGlobalKeys
      Call Start
    Else
       ...
You notice anything wrong there? I hope you do.
darksnow
ill still a noob at this so its best if you can explain tongue.gif
DaMOB
QUOTE(darksnow @ May 14 2009, 01:53 PM) *
ill still a noob at this so its best if you can explain tongue.gif

I can't explain it to you as it is something you learn in programming. It is not just an ACTool thing it is in all languages.

Well, I have not seen all of your code but what it looks like to me is that Call is jumping out of the procedure and starting all over again. If it does that eventually you will have a stack space full of manure and no stack space left for anything else and KERBOOM, crash.

I will not simply hand you the code but I will let you know, so you learn, if something is wrong or potentially could be wrong. So, post more code when you fix stuff. As it stands now that little snippet is saying that call is wrong but without the full code there is no way to be sure.
darksnow
this is my code
DaMOB
I was right.

Look you can't call start in there it is bad. I scanned over your code and all of the call starts you have need to be removed and fixed for the same reasons. I haven't even looked at the rest of your code due this severe issue.
darksnow
well this i wish to be able to turn a particular procedure on and off and using call is the only way i knwo how to do it.
is there another way?
DaMOB
Sure, there are numerous ways but you have to think logically and you need to know a little about programming.
Bear
OMG, that code is Nasty!! Why do you have While statements INSIDE of Procedure's?

Why is your Main While Statement inside a Procedure -> (Start) ??
DaMOB
QUOTE(Bear @ May 17 2009, 10:53 AM) *
OMG, that code is Nasty!! Why do you have While statements INSIDE of Procedure's?

Why is your Main While Statement inside a Procedure -> (Start) ??

Bear, he doesn't know how to program but he is at least trying. Now he needs to go that extra step before I will help him any farther.
Bear
QUOTE(DaMOB @ May 17 2009, 11:07 AM) *
QUOTE(Bear @ May 17 2009, 10:53 AM) *
OMG, that code is Nasty!! Why do you have While statements INSIDE of Procedure's?

Why is your Main While Statement inside a Procedure -> (Start) ??

Bear, he doesn't know how to program but he is at least trying. Now he needs to go that extra step before I will help him any farther.


Actually if it wasn't for all the while statements that call themselves (Recursion Loop) code looked alot better then most of the people that come here looking for code hand outs.
cheers... *Goes off to lurk......* tongue.gif
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.