• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Page 1 of 2 12 LastLast
    Results 1 to 10 of 11
    1. #1
      RTFM
      Shootin Pool!
       
      Coding
       
      Syperus's Avatar
      Join Date
      Oct 2012
      Location
      127.0.0.1
      Posts
      436
      Thanks (-->)
      101
      Thanks (<--)
      131

      Program freezing during loop

      Silent VPN
      Sup everyone. Aight I've been hesitant on creating this thread, but I'm all out of ideas. I've been having problems with my program, trainer I've been working on, freezing up when I start a while loop. It still works as intended, but the program itself freezes. My last resort was to try using Fleep's system check using clock(), but i still get the same effect. Here's the code i put in a checkbox checkedchanged function
      Code:
      bool timerstate = false;
      int lapse = clock();
      
      if (cb1->Checked)
      {
         timerstate = true;
      				 
         while(timerstate != false)
            {
               if(clock() - lapse > 5000)
                  {
                       //memory code ect..
                       lapse = clock();
      					 
                   } 
      				 
              }
      					 
       }
      else
      {
            timerstate = false;
      }
      I set it to 5000(5 seconds) to make sure it wasn't getting thrown into an infinite loop. So can anyone see anything wrong with this?

      My info:
      Compiler: Visual Studio 2010 Ultimate
      Operating System: Windows 7 64bit
      Memory: 8gb
      Blacks Ops Zombies, BioShock Infinite Array of Bytes
      "People say I'm a bad influence. I say the world's already fucked, I'm just adding to it" -Eminem

    2. #2
      Hacker
      shell toes yes
       
      Lagging
       
      squeenie's Avatar
      Join Date
      Mar 2013
      Posts
      717
      Thanks (-->)
      599
      Thanks (<--)
      222
      Shouldn't lapse maybe += clock() instead of =?
      Last edited by squeenie; 03-06-2013 at 10:25 AM.

    3. #3
      Hacker
      Working, University, Coding ..
       
      Drinking
       
      GAFO666's Avatar
      Join Date
      Aug 2012
      Location
      if(PlayerBase << 16) return IdontKnow("yolo");
      Posts
      531
      Thanks (-->)
      33
      Thanks (<--)
      102

    4. #4
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      Chuck E's Avatar
      Join Date
      Jan 2013
      Location
      United Kingdom
      Posts
      119
      Thanks (-->)
      30
      Thanks (<--)
      20
      Excuse me for possibly being silly here, but presumably you are setting timerstate to false (= exit while loop) somewhere within that While loop (once a certain condition is true of course) ?

      So within the while loop, the timer is reset every 5 seconds. What is supposed to trigger it exiting the loop ?
      Last edited by Chuck E; 03-08-2013 at 04:34 PM.

    5. #5
      RTFM
      Shootin Pool!
       
      Coding
       
      Syperus's Avatar
      Join Date
      Oct 2012
      Location
      127.0.0.1
      Posts
      436
      Thanks (-->)
      101
      Thanks (<--)
      131
      Quote Originally Posted by Chuck E View Post
      Excuse me for possibly being silly here, but presumably you are setting timerstate to false (= exit while loop) somewhere within that While loop (once a certain condition is true of course) ?

      So within the while loop, the timer is reset every 5 seconds. What is supposed to trigger it exiting the loop ?
      I'm calling it within a checkbox_checkedchange function call. When the box is checked it starts the timer. When the checkbox is unchecked it sets the timerstatus function to false. So during the while loop every time it loops it checks to see if timerstatus is true or false.
      Blacks Ops Zombies, BioShock Infinite Array of Bytes
      "People say I'm a bad influence. I say the world's already fucked, I'm just adding to it" -Eminem

    6. #6
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      Chuck E's Avatar
      Join Date
      Jan 2013
      Location
      United Kingdom
      Posts
      119
      Thanks (-->)
      30
      Thanks (<--)
      20
      Never mind me, I just can't see how that exits the while loop after the first time it enters it. It's not going to take anymore input from the checkbox, because it's wizzing around in that loop.

      Sorry, my mind is going over and over here, attempting to see the logic from different angles.

      I love puzzles, I'll look again at this tomorrow when I have a fresh head

      Hmm, hang on...

    7. #7
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      Chuck E's Avatar
      Join Date
      Jan 2013
      Location
      United Kingdom
      Posts
      119
      Thanks (-->)
      30
      Thanks (<--)
      20
      Code:
      bool timerstate = false;int lapse = clock();
      
      
      
      
      if (cb1->Checked)// CHECKBOX IS CHECKED
      {
         timerstate = true;
                       
         while(timerstate != false)  // keep on looping until timerstate is set to false
            {
               if(clock() - lapse > 5000)  // current time minus our start time, has 5 seconds passed?
                  {                                                        // Yep, it has
                       //memory code ect..
                       lapse = clock(); // reset timer 
                           
                   } 
                       
              } // continue looping - HOW DO I EXIT ??? CONFUZZLED! 
                           
       }
      else// CHECKBOX IS NOT CHECKED
      {
            timerstate = false;
      }
      Man, I thought Crypt was the one who set coding challenges here !

      You've flummoxed me, lol. You bad person

      I'll look at this again tomorrow, and no doubt will have a D'oh moment

    8. #8
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      492

      HOW DO I EXIT ??? CONFUZZLED!
      Keyword
      Code:
      break
      is the answer
      Program freezing during loop

    9. #9
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Radobot's Avatar
      Join Date
      Dec 2012
      Posts
      13
      Thanks (-->)
      0
      Thanks (<--)
      0
      From my personal experience I know that loop running on same thread as GUI will always freeze no matter what. Only way that worked for my was to use multiple threads (with working "timerstate" check to stop).

    10. #10
      Hacker
      shell toes yes
       
      Lagging
       
      squeenie's Avatar
      Join Date
      Mar 2013
      Posts
      717
      Thanks (-->)
      599
      Thanks (<--)
      222
      Silent VPN
      Oh right, if using GUI better to use if > 5000

    Page 1 of 2 12 LastLast

    Similar Game Hacker Threads

    1. [Help] 32-bit Loop Crash
      By AlphaAnonymous in forum AntiCheat - AntiDebug
      Replies: 12
      Last Post: 05-06-2016, 12:40 PM
    2. [Discuss] Possible to disassemble the Windows event loop?
      By snorble in forum C/C++
      Replies: 4
      Last Post: 03-27-2016, 11:26 PM
    3. [Help] Loop through enemies
      By RaZor1994 in forum C#
      Replies: 15
      Last Post: 08-14-2015, 01:35 PM
    4. Replies: 24
      Last Post: 07-11-2015, 06:45 AM
    5. [Help] Freezing value of address
      By Froze in forum Hacking Help
      Replies: 8
      Last Post: 12-02-2014, 10:29 AM

    Tags for this Thread