Jump to content


need help on a loop commad


  • Please log in to reply
6 replies to this topic

#1 johnny94

johnny94
  • Guests

Posted 13 September 2012 - 07:29 AM

Hey I need help on a loop command please. I'm inexperienced, so bare with me please. I also tried the Loop Command article, but I don't understand it.

I want to make a loop that types the following in quotes: "/hello"
It should be typed and entered automatically every 2 minutes.

Any ideas on how to do that?

Also, what commands do I have to enter to activated and deactivate the loop?

Thank You,
Johnny.

#2 ScripterZ

ScripterZ
  • Members
  • 49 posts

Posted 13 September 2012 - 07:36 AM

There's 2 ways to do this.
while (variable) { ; while the variable is true, it loops
   sendraw /hello
   sleep 120000 ; 120 seconds
}
or:
Loop { ; you need to manually end this
   sendraw /hello
   sleep 120000
}
There's 2 commands for loops you need to know:
continue - skips the rest of the loop and starts a new one, if there's no more loops, it simply ends
break - ends the loop and continues with the rest of the code

#3 johnny94

johnny94
  • Guests

Posted 13 September 2012 - 07:41 AM

how do i start the loop?

#4 HotKeyIt

HotKeyIt
  • Fellows
  • 6119 posts

Posted 13 September 2012 - 07:45 AM

Try this.
; To start press CTRL+ALT+SHIFT+S

^!+s::

SetTimer,Send,120000

Send:

sendraw /hello

Return

; To start press CTRL+ALT+SHIFT+A

^!+a::SetTimer,Send,Off


#5 johnny94

johnny94
  • Guests

Posted 13 September 2012 - 07:55 AM

thanks a lot HotKeyIt, the script works perfectly :D

#6 johnny94

johnny94
  • Guests

Posted 13 September 2012 - 08:05 AM

Sorry to double post, but one thing.

What if I'm playing a game, and I need to enter this in the chat box.

I enabled the command, and it just types out the command in the games chat box, but it doesn't enter the command for me. Any ideas?

On my other ahk script where I use sendinput, I use {enter} to enter the commands in the game, but that doesn't work with this loop.

#7 johnny94

johnny94
  • Guests

Posted 13 September 2012 - 08:08 AM

oh wait never mind i got it to work =p

; To start press CTRL+ALT+SHIFT+S
^!+s::
SetTimer,Send,210000
Send:
sendraw /hello
sendinput {enter}
Return
; To start press CTRL+ALT+SHIFT+A
^!+a::SetTimer,Send,Off

thanks