w9s66v09c8x5o1fl3p0

Rifbot Custom Macro Responder

Jan 11th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. --[[
  2.     Script Name:        Custom Macro Responder
  3.     Description:        Respond flashing letters on screen. Required Rifbot v1.31
  4.     Author:             Ascer - example
  5. ]]
  6.  
  7. local RESPOND_DELAY = {20, 90}              -- random respond time between 20sec and 90sec
  8. local PAUSE_BOT = true                      -- true/false pause afk functions when you are under macro test  
  9.  
  10. -- DON'T EDIT BELOW THIS LINE
  11.  
  12. local respondTime, respondDelay = 0, 0
  13.  
  14. Module.New("Custom Macro Responder", function ()
  15.     local code = Rifbot.getMacroCode()
  16.     printf(code)
  17.     if not Self.isConnected() and respondTime ~= 0 then
  18.         respondTime = 0 -- reset timer on self.logout
  19.     end    
  20.     if code ~= "" then
  21.         if respondTime == 0 then -- set new delay
  22.             respondTime = os.clock()
  23.             respondDelay = math.random(RESPOND_DELAY[1], RESPOND_DELAY[2])
  24.             if PAUSE_BOT then    
  25.                 Rifbot.setMacroMode(true) -- enable macro mode
  26.             end    
  27.         else
  28.             if os.clock() - respondTime >= respondDelay then
  29.                 Self.Say(code) -- say code and enable bot
  30.                 wait(2000, 5000)
  31.                 respondTime = 0
  32.                 Rifbot.setMacroMode(false)      
  33.             end
  34.         end
  35.     end            
  36. end)
Add Comment
Please, Sign In to add comment