Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how to exit a diffrent sub - please read my update[atachmnt]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Haxory'
Grandmaster Cheater Supreme
Reputation: 92

Joined: 30 Jul 2007
Posts: 1900

PostPosted: Tue Mar 04, 2008 7:14 am    Post subject: how to exit a diffrent sub - please read my update[atachmnt] Reply with quote

ima code something for you guys Very Happy Very Happy Very Happy

Chech the attatchment aoi and wiccaan

how to exit a diffrent sub by clicking on a button?

for instance

Code:
Private Sub Command1_Click()
For N = 1 To 999999
If Text1.Text = N Then
Text2.Text = N
Exit Sub
End If
Next N
End Sub


but it gets slow and i want to exit the sub

what do i change to "???" if i want to stop "Private Sub Command1_Click()" ????


Code:
Private Sub Command2_Click()
???
End Sub


i will +rep the first one which posts working code



The Extension 'zip' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel


Last edited by Haxory' on Wed Mar 05, 2008 11:26 am; edited 3 times in total
Back to top
View user's profile Send private message
AoiMasamune
Master Cheater
Reputation: 1

Joined: 14 Jun 2007
Posts: 255

PostPosted: Tue Mar 04, 2008 8:04 am    Post subject: Reply with quote

Code:

Public bRunning as Boolean

Public Sub BruteForceLoop()

     For N = 1 To 999999

          If bRunning = False Then
               Exit Sub
          End If

          If Val(Text1.Text) = N Then
               Text2.Text = N
               Exit Sub
          End If

     Next N

End Sub

Private Sub Command1_Click()
     'start loop
     bRunning = True
     Call BruteForceLoop
End Sub

Private Sub Command2_Click()
     'force loop to exit
    bRunning = False




EDIT: LOL, nice update.


Last edited by AoiMasamune on Wed Mar 05, 2008 12:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue Mar 04, 2008 10:06 am    Post subject: Reply with quote

A suggestion to the above code, use Option Explicit and define all your variables, it's better practice and you will not have that option in other languages if and when you move on.

Code:
Option Explicit

Private TickEnable  As Boolean
Private TickCount   As Long

Private Sub Form_Load()
    TickEnable = False              ' Default TickEnable To False
    TickCount = 0                   ' Clear TickCount At Start
End Sub

Private Sub Command1_Click()
    TickEnable = True               ' Enable TickEnable
    Call TickLoop                   ' Call Loop Function
End Sub
Private Sub Command2_Click()
    TickEnable = False              ' Disable TickEnable
End Sub

Private Sub TickLoop()
    Do While TickEnable = True      ' Loop While Enabled
        TickCount = TickCount + 1   ' Increase Count By One
        Text1.Text = TickCount      ' Display Current Count
        DoEvents                    ' Prevent Freezing With Do Loops
    Loop
End Sub


If you want to test this, add 1 textbox and two buttons to a form.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Haxory'
Grandmaster Cheater Supreme
Reputation: 92

Joined: 30 Jul 2007
Posts: 1900

PostPosted: Tue Mar 04, 2008 10:33 am    Post subject: Reply with quote

Wiccaan wrote:


If you want to test this, add 1 textbox and two buttons to a form.


im not retard Razz

but thank you guys!

_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites