Jump to content
Coda

ispressed func prob

Recommended Posts

Coda

Heyo
My problem is iam using ispressed func in while but i don't have the idea how to end it :

 

While 1
if _IsPressed(12) then
Send("{Space}")
sleep(17)
Send("{Space}")
endif
wend

My problem is it gonna sends space all the time so how can i stop it ? also without using exitloop since i want to use the same func again.

Share this post


Link to post
Share on other sites
Melba23

Coda,

Just wait until the key is released before continuing - look at the example in the Help file which shows exactly how to do it.

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

 

Share this post


Link to post
Share on other sites
Coda
1 hour ago, Melba23 said:

Coda,

Just wait until the key is released before continuing - look at the example in the Help file which shows exactly how to do it.

M23

As i said it always send space i want a way to stop it and wait until i press alt again and so one.

Share this post


Link to post
Share on other sites
Melba23

Coda,

Which is what I have told you above will achieve: press the key and {SPACE} is sent twice, wait for the key to be released and then continue to loop until the key is pressed again:

While 1
    ; Is the key pressed?
    If _IsPressed(12) Then
        ; Yes, so send {SPACE} twice
        Send("{Space}")
        Sleep(17)
        Send("{Space}")
        ; Now wait for the key to be released
        While _IsPressed(12)
            Sleep(10) ; Do this to stop the CPU overheating
        Wend
        ; Now the key is released, so reenter the loop
    Else
        ; No, key not pressed
        Sleep(10) ; Again do this to prevent the CPU overheating if key is not pressed
    EndIf
WEnd

And as you are calling _IsPressed in a tight loop, I would also strongly recommend opening 'user32.dll' first and using the returned handle in the $vDLL parameter.

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

 

Share this post


Link to post
Share on other sites
Coda
5 minutes ago, Melba23 said:

Coda,

Which is what I have told you above will achieve: press the key and {SPACE} is sent twice, wait for the key to be released and then continue to loop until the key is pressed again:

While 1
    ; Is the key pressed?
    If _IsPressed(12) Then
        ; Yes, so send {SPACE} twice
        Send("{Space}")
        Sleep(17)
        Send("{Space}")
        ; Now wait for the key to be released
        While _IsPressed(12)
            Sleep(10) ; Do this to stop the CPU overheating
        Wend
        ; Now the key is released, so reenter the loop
    Else
        ; No, key not pressed
        Sleep(10) ; Again do this to prevent the CPU overheating if key is not pressed
    EndIf
WEnd

And as you are calling _IsPressed in a tight loop, I would also strongly recommend opening 'user32.dll' first and using the returned handle in the $vDLL parameter.

M23

Thanks for your effort bro but i need something to pause the script after it send the second send cuz in my game if i pressed alt it always send space

Share this post


Link to post
Share on other sites
Melba23

Coda,

Firstly, you have obviously not tried the code I gave you because that is exactly what it does.

Secondly I warned you here that our patience has limits, but you continue to post gamebot scripts. I am sorely tempted to ban you now, but you get one, and only one, more chance - another game-related script and you will be removed from the community.

Thread locked.

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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×