// Auto Loop Chat Messages - Release Version 2.0.1
// Written by: Edward_shooter
// Download Link: https://gamebanana.com/scripts/9918

// For Manual Version, use Spam Script Maker from doodlesstuff.com
// Download Link: http://doodlesstuff.com/?p=spamscriptmaker


// Status
echo "chat_loop_auto.cfg"
echo "Status: Active"
echo "Info: press [Keypad Minus] to Start/ Stop Loop"
echo " "


// Keys
bind KP_MINUS "ChatLoop_Toggle"   // Start/ Stop Loop


// Script
alias ChatLoop_Toggle "ChatLoop_Start_WaitTester"
alias ChatLoop_Start "ChatLoop_SFX1; alias ChatLoop_Toggle ChatLoop_Pause_Start; alias ChatLoop_Say ChatLoop_Say_On; alias ChatLoop_Loop ChatLoop_LoopA; alias ChatLoop_Redirect ChatLoop_Redirect_Start; ChatLoop_Loop_WaitTester"
alias ChatLoop_Stop "ChatLoop_SFX2; alias ChatLoop_Toggle ChatLoop_Start_WaitTester; alias ChatLoop_Loop; alias ChatLoop_Redirect "

alias ChatLoop_Loop ""   // Using aliases to change the wait durations will summon the Source Spaghetti Monster...
alias ChatLoop_LoopA "ChatLoop_Say; wait 198; ChatLoop_Redirect"    // Start Duration      // 66 ticks x 3 seconds  = 198  ticks
alias ChatLoop_LoopB "ChatLoop_Say; wait 2178; ChatLoop_Redirect"   // Cooldown Duration   // 66 ticks x 33 seconds = 2178 ticks
alias ChatLoop_LoopC "ChatLoop_Say; wait 1188; ChatLoop_Redirect"   // Loop Duration       // 66 ticks x 18 seconds = 1188 ticks

alias ChatLoop_Redirect ""   // Execute additional setup before Loop
alias ChatLoop_Redirect_Start "alias ChatLoop_Toggle ChatLoop_Pause_Loop; alias ChatLoop_Loop ChatLoop_LoopC; alias ChatLoop_Redirect ChatLoop_Redirect_Loop; ChatLoop_Loop_WaitTester"
alias ChatLoop_Redirect_Stop "alias ChatLoop_Toggle ChatLoop_Cooldown; alias ChatLoop_Say ChatLoop_Say_Off; alias ChatLoop_Loop ChatLoop_LoopB; alias ChatLoop_Redirect ChatLoop_Stop_WaitTester; ChatLoop_Loop_WaitTester"
alias ChatLoop_Redirect_Loop "ChatLoop_Loop_WaitTester"

alias ChatLoop_Pause ""   // Determine whether it is Double-Click or Stop Loop
alias ChatLoop_Pause_Start "ChatLoop_SFX2; alias ChatLoop_Toggle ChatLoop_Resume_Start; alias ChatLoop_Redirect ChatLoop_Redirect_Stop"
alias ChatLoop_Pause_Loop "ChatLoop_SFX2; alias ChatLoop_Toggle ChatLoop_Resume_Loop; alias ChatLoop_Redirect ChatLoop_Redirect_Stop"

alias ChatLoop_Resume ""   // Continue Loop and Execute Double-Click
alias ChatLoop_Resume_Start "ChatLoop_SFX1; alias ChatLoop_Toggle ChatLoop_Pause_Start; alias ChatLoop_Redirect ChatLoop_Redirect_Start"
alias ChatLoop_Resume_Loop "ChatLoop_SFX1; alias ChatLoop_Toggle ChatLoop_Pause_Loop; alias ChatLoop_Redirect ChatLoop_Redirect_Loop; ChatLoop_2kliks"

alias ChatLoop_Cooldown "ChatLoop_SFX3; echo >> ChatLoop script in cooldown..."   // Prevent reaching "chat limit"
alias ChatLoop_2kliks "alias ChatLoop_Say ChatLoop_Say_Text1"   // Double-Click = 2 clicks = 2kliksphilip :D

alias ChatLoop_Say ""
alias ChatLoop_Say_On "alias ChatLoop_Say ChatLoop_Say_Text1; say Script On"                                // Type out On message; Set message 1 as next
alias ChatLoop_Say_Off "alias ChatLoop_Say ; say Script Off"                                                // Type out Off message; Set Null as next
alias ChatLoop_Say_Error "alias ChatLoop_Say ; say Hello World!"                                            // Type out Error message; Set Null as next
alias ChatLoop_Say_Text1 "alias ChatLoop_Say ChatLoop_Say_Text2; say Get Food, Get LunchBox"                // Type out message 1; Set message 2 as next
alias ChatLoop_Say_Text2 "alias ChatLoop_Say ChatLoop_Say_Text3; say LmaoBox - Way To The Cops"             // Type out message 2; Set message 3 as next
alias ChatLoop_Say_Text3 "alias ChatLoop_Say ChatLoop_Say_Text1; say www.sandvich.net - Best TF2 Snacks!"   // Type out message 3; Set message 1 as next

alias ChatLoop_SFX0 "play ui/system_message_alert.wav"
alias ChatLoop_SFX1 "play /ui/buttonclick.wav"
alias ChatLoop_SFX2 "play /ui/panel_close.wav"
alias ChatLoop_SFX3 "play /ui/training_point_big.wav"


// 'wait' Testing
// https://wiki.teamfortress.com/wiki/Scripting#Wait-testing

alias wait "alias ChatLoop_LoopTest1 ChatLoop_LoopTest1_Negative; alias ChatLoop_LoopTest2 ChatLoop_LoopTest2_Negative; alias ChatLoop_LoopTest3 ChatLoop_LoopTest3_Negative"

alias ChatLoop_Error "ChatLoop_SFX0; echo >> 'wait' command is Disabled on this server!!!; alias ChatLoop_Toggle ChatLoop_Start_WaitTester; alias ChatLoop_Loop ; alias ChatLoop_Redirect "

alias ChatLoop_Start_WaitTester "alias ChatLoop_LoopTest1 ChatLoop_LoopTest1_Positive; wait; ChatLoop_LoopTest1"
alias ChatLoop_LoopTest1_Positive "ChatLoop_Start"
alias ChatLoop_LoopTest1_Negative "ChatLoop_Error; ChatLoop_Say_Error"

alias ChatLoop_Stop_WaitTester "alias ChatLoop_LoopTest2 ChatLoop_LoopTest2_Positive; wait; ChatLoop_LoopTest2"
alias ChatLoop_LoopTest2_Positive "ChatLoop_Stop"
alias ChatLoop_LoopTest2_Negative "ChatLoop_Error; ChatLoop_Say_Off"

alias ChatLoop_Loop_WaitTester "alias ChatLoop_LoopTest3 ChatLoop_LoopTest3_Positive; wait; ChatLoop_LoopTest3"
alias ChatLoop_LoopTest3_Positive "ChatLoop_Loop"
alias ChatLoop_LoopTest3_Negative "ChatLoop_Error; ChatLoop_Say_Error"