Jump to content

My code is not calling the second function


Go to solution Solved by Cypharr,

Recommended Posts

Posted

Disclaimer: this is not for a game

 

Global $ASleep ; Declare a variable - to store the random numbers
Global $BSleep ; Declare a variable - to store the random numbers

A()
B()

Func A()

While 1 ;loop indefinitely
    
    $ASleep = Random(4800, 6000,1)
        
        ControlSend("","","","z",1)
                
    Sleep($ASleep)
    
WEnd

EndFunc

Func B()

While 1 ;loop indefinitely
    
    $BSleep = Random(4800, 6000,1)
                
        ControlSend("","","","a",1)

    Sleep($BSleep)
    
WEnd

EndFunc

 

Fun B() does nothing I don't know why.

  • Moderators
Posted

Cypharr,

Quote

this is not for a game

You get the benefit of the doubt this time.

Function A() has in infinite loop from which you never escape - hence no other code is actioned. You need to add some form of escape from that loop - and the same goes for function B().

M23

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

 

Posted

I'm trying to learn the language. Due to the rules and regulations of the forum I had to seek a different project to use in the learning process. Thank you for giving me the benefit of the doubt.

So do I just put an Exit after the sleep function or an ExitLoop? I'm reading on both

Posted

My BSc Certificate

That's my BSc certificate, I studied computer games development that's why my default projects are usually games. However I had to seek alternative so I can learn AutoIt. YouTube is helpful but not quite hands on as I see the forum to be.

  • Solution
Posted
Global $ASleep ; Declare a variable - to store the random numbers
Global $BSleep ; Declare a variable - to store the random numbers

While 1 ;loop indefinitely

A()
B()

WEnd

Func A()

    $ASleep = Random(4800, 6000,1)
    ControlSend("","","","z",1)
    Sleep($ASleep)
    
EndFunc

Func B()

    $BSleep = Random(4800, 6000,1)       
    ControlSend("","","","a",1)
    Sleep($BSleep)
    
EndFunc

 

I was able to use some tutorials on YT to get this far. Seems to be okay for now until I get better and know of better ways to write the code.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...