Share Pastebin
Guest
Public paste!

timer :D

By: a guest | Sep 2nd, 2010 | Syntax: C | Size: 1.64 KB | Hits: 19 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. /*                  :D :D Test code for kittieh :D :D                   *\
  2. /*----------------------------------------------------------------------*\
  3. /*-one button which enables and disables a timer event                  *\
  4. /*-the timer event itself, which just keeps echoing an embarassing fact.*\
  5. /************************************************************************\
  6.  
  7.  
  8.         /* ADD THE FOLLOWING UNDER YOUR INCLUDES */
  9. bool test_function = false;
  10. #define TID_TESTFUNCTION 1337
  11. //code is easier to read if we dont have to write the id manually in the code
  12. //TID is an abbreiviation of my own making (Timer ID)
  13.         /*END*/
  14.  
  15.        
  16.        
  17.  
  18.        
  19. void CCheatzDlg::OnTimer(UINT nIDEvent) //Not sure how this function has to be added, so back up your project before you start trying!
  20.                                                                                 //either somewhere in the dialog interface, or you just add it manually
  21.         if (test_function&&nIDEvent==#TID_TESTFUNCTION) { //check if 1) test_function is true and 2) if the right timer was triggered
  22.             j2.TSFEcho("Shelly likes tentacle porn :-D<-`<");
  23.         }                                                                      
  24.         CDialog::OnTimer(nIDEvent); //Not sure what this was, but it was in my code
  25. {      
  26.        
  27. void CCheatzDlg::Ontest_function() //CREATE THIS FUNCTION AS A BUTTON
  28. {
  29.         if (!test_function) {   //if test_function isn't on yet, we turn it on
  30.  
  31.                 Jazz2 j2;
  32.                 SetTimer(TID_TESTFUNCTION,1,0);
  33.                 test_function=true;
  34.                 j2.TSFEcho("The timer should now be turned on");
  35.        
  36.         }
  37.         else {                  //if test_function is already on, we turn it off
  38.                 j2.TSFEcho("The timer should now be turned off (to do!)");
  39.                 test_function=false;
  40.                 //I don't know if the timer needs to be turned off somehow with a command. Should ask jam! :D
  41.         }
  42. }