Advertisement
Doug4347

MTG Ringtones (2.0)

Nov 18th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Menu, Tray, NoStandard
  2. Menu, Standards, Standard
  3. Menu, Script, Add, Select Ringtone, SelectRingtone
  4. Menu, Script, Add, Select Message Tone, SelectMessageTone
  5. Menu, Tray, Add, Script Stuff, :Script
  6. Menu, Tray, Add, Standard Stuff, :Standards
  7. IncomingCallText = Incoming call on
  8. PickUpText = You have picked up the phone
  9. MessageText = You got a message on your phone
  10. RingStopText = The ringing has stopped
  11. SettingsFile = Settings.ini
  12. File = %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
  13. IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, None
  14. IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, None
  15. If Ringtone = None
  16.     Gosub, SelectRingtone
  17. If MessageTone = None
  18.     Gosub, SelectMessageTone
  19. IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, None
  20. IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, None
  21. SplashImage,,, Testing Ringtone..., Ringer
  22. SoundPlay, %Ringtone%
  23. Sleep, 10000
  24. SplashImage,,, Testing Message Tone..., Ringer
  25. SoundPlay, %MessageTone%
  26. Sleep, 10000
  27. SplashImage,,, Done!, Ringer
  28. SoundPlay, Silence.Silence
  29. Sleep, 1000
  30. SplashImage, Off
  31. Process, Wait, gta_sa.exe
  32. Goto, CheckChat
  33. Return
  34.  
  35. SelectRingtone:
  36.     FileSelectFile, Ringtone, 3,, Select a new Ringtone (Audio Files Only)
  37.     IniWrite, %Ringtone%, %SettingsFile%, Tones, Ringtone
  38.     MsgBox, 64, Ringtone Set!, New Ringtone Set!
  39. Return
  40.  
  41. SelectMessageTone:
  42.     FileSelectFile, MessageTone, 3,, Select a new Message Tone (Audio Files Only)
  43.     IniWrite, %MessageTone%, %SettingsFile%, Tones, MessageTone
  44.     MsgBox, 64, Message Tone Set!, New Message Tone Set!
  45. Return
  46.  
  47. CheckChat:
  48. Loop,
  49. {
  50.     FileReadLine, NoLine, %File%, %A_Index%
  51.     If ErrorLevel
  52.         Break
  53.     Index:=A_Index-2
  54. }
  55. Loop,
  56. {
  57.     FileReadLine, Line, %File%, %Index%
  58.     If ErrorLevel
  59.     {
  60.         Index-=3
  61.         If Index < 1
  62.         {
  63.             Index = 1
  64.         }
  65.     FileReadLine, Line, %File%, %Index%
  66.     }
  67.     Index+=2
  68.     ; MsgBox, %Line%
  69.     Ringing:=InStr(Line, IncomingCallText)
  70.     PickedUp:=InStr(Line, PickUpText)
  71.     RingingStopped:=InStr(Line, RingStopText)
  72.     MessageReceived:=InStr(Line, MessageText)
  73.     If Ringing and not RingingOn
  74.         GoSub, Ringer
  75.     If PickedUp or RingingStopped
  76.         GoSub, StopRinging
  77.     If MessageReceived
  78.         GoSub, Messaged
  79. }
  80. Return
  81.  
  82. Ringer:
  83.     RingStart:=A_TickCount
  84.     IniRead, Ringtone, %SettingsFile%, Tones, Ringtone, None
  85.     RingingOn:=True
  86.     SoundPlay, %Ringtone%
  87. Return
  88.  
  89. StopRinging:
  90.     SoundPlay, Silence.Silence
  91.     RingingOn:=False
  92. Return
  93.  
  94. Messaged:
  95.     IniRead, MessageTone, %SettingsFile%, Tones, MessageTone, None
  96.     RingingOn:=False
  97.     SoundPlay, %MessageTone%
  98.     FileAppend, This line has been placed here by AHK to prevent the script from reading the same line twice.`n`n, %File%
  99. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement