Jump to content

Just learning, trying to find a way to pause a loop and restart after it preforms another function. - (Locked)


Recommended Posts

Posted
#cs ----------------------------------------------------------------------------

     AutoIt Version: 3.3.18.0
     Author:         emmi

     Script Function:
        Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
; --- Configuration ---
Global $targetKey = "w"      ; The key to spam
Global $toggleKey = "{F4}"   ; The button that turns the spammer on/off
Global $spamDelay = 1150       ; Delay between clicks in milliseconds
; ---------------------

Global $isSpamming = False

; Set the hotkey to call the ToggleSpam function
HotKeySet($toggleKey, "ToggleSpam")

; Keep script running
While 1
    If $isSpamming Then
        Send($targetKey)
        Sleep($spamDelay) ; Controls speed
    Else
        Sleep(100) ; Idle sleep to save CPU
    EndIf
WEnd

Func ToggleSpam()
    $isSpamming = Not $isSpamming ; Toggle state
    If $isSpamming Then
        ToolTip("Spammer ON", 0, 0)
    Else
        ToolTip("Spammer OFF", 0, 0)
    EndIf
EndFunc

This is the code in currently using, i found some example codes, and made the small edits to what i needed for it to work.

 

what im looking for is a way to have it automatically pause every X seconds, then send other keystrokes, and when completed return to the spam key loop. ive looked around and found some information, but was too complicated for me to pick out what parts of the code do what. i've been googling quite a bit but most things that show up with the loop/pause in the search just show the toggle like im currently using. (i dont want to get rid of the toggle, i, for example, want the loop to every 10 mins stop pressing W and press a,b,c and then continue pressing W -note not what i need but if i can learn to do this i can then write what i need)

 

any help, or even pointing me to a resource to learn how to accomplish this so i can learn, would be great, thank you.

Posted

i read the rules, it is for a game however it is a single player game, im using it for their crafting system to spam craft a single item and then every X minutes based on crafting speed, use it to sell inventory to empty bags, i just dont want to have to sit there and press buttons over and over. some other players have stated they use either their gaming pcs that software intergrated to preform the same actions like razer software that allows them to do this, but i dont have one of those. so someone recommended AHK, or this.

  • Moderators
Posted

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...