Sign in to follow this  
Followers 0
flaxcrack

Is it possible to end one function with another?

10 posts in this topic

#1 ·  Posted (edited)

I have two functions and I would like for one function to be able to end the other function but not stop the program that is running.

Here is what I mean: My first function send a single key stroke every 45 seconds with the Send() and Sleep(). While sleeping it is impossible to click the "Close" button on the title bar because of the Do() loop. I am however using hotkeys and when the Esc button is pressed it send the Exit which closes the entire application. What I need is to just halt the one function that is Send() and Sleep(). Is this possible? From what I see it is not unless I apply some logic that breaks the Sleep() into pieces. :lmao:

;_ACraft is called when the OK button from the GUI is pressed.
Func _ACraft()
    Do
    GUISetState(@SW_MINIMIZE)
    Send($WhatButton)
    Sleep($HowOften & "000")
    $Nul = $Nul + 1
    Until $Nul = $HowMany   
EndFunc

;Terminate() is being called by the Esc Key.
Func Terminate()
    Exit
EndFunc

Let me know!

*fixed errors

Edited by flaxcrack

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites



I guess I could

Global $Term = 0

Func _ACraft()
    Do
    GUISetState(@SW_MINIMIZE)
    Send($WhatButton)
    Sleep($HowOften & "000")
    If $Term = 1 Then 
        ExitLoop
    EndIf
    
    $Nul = $Nul + 1
    Until $Nul = $HowMany   
EndFunc

Func Terminate()
    $Term = 1
EndFunc

But this doesn't kill the Do() loop then. It has to wait the duration of $HowOften & "000". I guess it is a work around for now.


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

I guess I could

Global $Term = 0

Func _ACraft()
    Do
    GUISetState(@SW_MINIMIZE)
    Send($WhatButton)
    Sleep($HowOften & "000")
    If $Term = 1 Then 
        ExitLoop
    EndIf
    
    $Nul = $Nul + 1
    Until $Nul = $HowMany   
EndFunc

Func Terminate()
    $Term = 1
EndFunc

But this doesn't kill the Do() loop then. It has to wait the duration of $HowOften & "000". I guess it is a work around for now.

you could set your do loop up like this:

Func _ACraft()
    Do
                If $term Then
                        $Nul = $HowMany
                        ContinueLoop
                EndIf
    GUISetState(@SW_MINIMIZE)
    Send($WhatButton)
    Sleep($HowOften & "000")
    $Nul = $Nul + 1
    Until $Nul = $HowMany   
EndFunc

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Right, but it doesn't end the loop right then. And I guess that is what I want to do.


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

Right, but it doesn't end the loop right then. And I guess that is what I want to do.

my example does. it sets the exit condition, then aborts the current iteration, so even though there's a ContinueLoop, the next iteration shouldn't happen.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

my example does. it sets the exit condition, then aborts the current iteration, so even though there's a ContinueLoop, the next iteration shouldn't happen.

Wow, your right, but the strange thing is it works but it doesn't. I have a MSGBOX() to tell me when that script is done and how long it took it. When I press Esc it takes it 45 seconds to get the MSGBOX() but it will report back that it only took .075 seconds for the scripts duration.


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

Wow, your right, but the strange thing is it works but it doesn't. I have a MSGBOX() to tell me when that script is done and how long it took it. When I press Esc it takes it 45 seconds to get the MSGBOX() but it will report back that it only took .075 seconds for the scripts duration.

you may have a different loop tying up more time. if you post a full listing of your code i can help troubleshoot.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

you may have a different loop tying up more time. if you post a full listing of your code i can help troubleshoot.

You got it. I'm going to look at it more. I really want to try and fix it myself, but if I can't fix it I will post. Thanks!


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

I'll PM you with the code. This code could be taken advantage of. =(


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I'll PM you with the code. This code could be taken advantage of. =(

i responded w/ a possible solution, haven't tested because i don't have the game here at work (or at home for that matter). As far as being taken advantage of, the code is made for a specific purpose, it couldn't be used for anything other than that purpose, so i wouldn't say 'could be taken advantage of' i'd say 'could be used by someone else but i want to keep it to myself'. But that's just my $.02

***edit***

i didn't post the code here because it's obvious you don't want it shared, but i think that this is something that others could definitely use (if they play that game) so i would encourage you to put it up in scripts and scraps. I have no ethical reservations about cheats or automation in games, but i'm all about making tools like this open domain so that everyone can use them.

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0