daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Mar 24th, 2015 270 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Key Modifiers:
  2. ; #=windows, +=shift, ^=ctrl, !=alt
  3. ; <=Left Key Only, >=Right Key Only
  4. ; RButton, LButton, MButton, WheelUP, WheelDown, XButton1, XButton2
  5.  
  6. ;-----Initialize-----
  7. #SingleInstance force
  8. #UseHook
  9. #MaxThreadsPerHotkey 1
  10. #InstallKeybdHook
  11. SendMode Input
  12.  
  13. FXSwitch(param)
  14. {
  15.  
  16.         ; #### OPEN OUR FILE ###
  17.         file := FileOpen("MasterEffect.h", "rw")  
  18.         if !IsObject(file)
  19.         {
  20.                 MsgBox Can't open "%FileName%" for writing.
  21.                 return
  22.         }
  23.  
  24.         ; ### GET THE CONTENTS
  25.         contents := file.Read()
  26.         Needle := "`#define " . param
  27.        
  28.  
  29.         ; ### FIND THE EFFECTS LINE
  30.         pos := InStr(contents, Needle)
  31.  
  32.         ; find the end of line
  33.         eol := "`r`n"
  34.         endpos := Instr(contents, eol, , pos)
  35.  
  36.         ; get the full line
  37.         FXLine := SubStr(contents, pos, endpos-pos)
  38.  
  39.  
  40.         ; ### GET OUR TOGGLE VALUE (0 or 1)
  41.         regex := "(" . Needle . ")([ \t]*)([0-1])([ \t]*)(.*)$"
  42.         FXValue := RegExMatch(FXLine, regex, SubPat)
  43.  
  44.  
  45.         ; ### TOGGLE THE VALUE
  46.         if(SubPat3 = "1")
  47.         {
  48.                 NewValue := "0"
  49.         }
  50.         else if (SubPat3 = "0")
  51.         {
  52.                 NewValue := "1"
  53.         }
  54.  
  55.         ; ### RECREATE FX LINE WITH NEW TOGGLE VALUE
  56.         NewFXLine :=  SubPat1 . SubPat2 . NewValue . SubPat4 . SubPat5
  57.  
  58.  
  59.         ; ### REPLACE THE FX LINE IN OUR ORIGINAL CONTENT
  60.         StringReplace, output, contents, %FXLine%, %NewFXLine%
  61.  
  62.  
  63.         ; **** WARNING: I COULDN'T SEEM TO OVERWRITE THE FILE SO IT NEEDS TO BE DELETED FIRST CURRENTLY ****
  64.  
  65.         ; ### DELETE THE OLD FILE
  66.         file.Close()
  67.         FileDelete, MasterEffect.h
  68.        
  69.         ; ### WRITE THE NEW FILE
  70.         file := FileOpen("MasterEffect.h", "rw")  
  71.         file.Write(output)
  72.         file.Close()
  73.  
  74. }
  75.  
  76. ;-----HotKeys-----
  77. #Numpad1::FXSwitch("USE_DEPTHBUFFER_OUTPUT")
  78. #Numpad2::FXSwitch("USE_TONEMAP")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top