Advertisement
Guest User

AutoRA

a guest
May 16th, 2014
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.41 KB | None | 0 0
  1. --Copyright (c) 2013, Banggugyangu
  2. --All rights reserved.
  3.  
  4. --Redistribution and use in source and binary forms, with or without
  5. --modification, are permitted provided that the following conditions are met:
  6.  
  7. --    * Redistributions of source code must retain the above copyright
  8. --      notice, this list of conditions and the following disclaimer.
  9. --    * Redistributions in binary form must reproduce the above copyright
  10. --      notice, this list of conditions and the following disclaimer in the
  11. --      documentation and/or other materials provided with the distribution.
  12. --    * Neither the name of <addon name> nor the
  13. --      names of its contributors may be used to endorse or promote products
  14. --      derived from this software without specific prior written permission.
  15.  
  16. --THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  17. --ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. --WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. --DISCLAIMED. IN NO EVENT SHALL <your name> BE LIABLE FOR ANY
  20. --DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. --(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. --LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. --ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. --(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. --SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26.  
  27.  
  28. windower.register_event('load',function ()
  29.  
  30.     version = '2.0.0'
  31.     delay = 0
  32.     RW_delay = 0
  33.     Ammo_delay = 0
  34.     retrn = 0
  35.     windower.send_command('unbind ^d')
  36.     windower.send_command('unbind !d')
  37.     windower.send_command('bind ^d ara start')
  38.     windower.send_command('bind !d ara stop')
  39.     windower.send_command('alias ara lua c autora')
  40.    
  41. end)
  42.    
  43. function start()
  44.     windower.add_to_chat(100, 'AutoRA  STARTING~~~~~~~~~~~~~~')
  45.     player = windower.ffxi.get_player()
  46.     if player.status == 1 then
  47.         auto = 1
  48.     elseif player.status == 0 then
  49.         auto = 0
  50.     end
  51.     shoot()
  52. end
  53.  
  54. function stop()
  55.     windower.add_to_chat(100, 'AutoRA  STOPPING ~~~~~~~~~~~~~~')   
  56.     auto = 0
  57. end
  58.  
  59. function shoot()
  60.     windower.send_command('input /shoot <t>')
  61. end
  62.  
  63. function shootOnce()
  64.     windower.send_command('input /shoot <t>')
  65. end
  66.  
  67. --Function Author:  Byrth
  68. function split(msg, match)
  69.     local length = msg:len()
  70.     local splitarr = {}
  71.     local u = 1
  72.     while u <= length do
  73.         local nextanch = msg:find(match,u)
  74.         if nextanch ~= nil then
  75.             splitarr[#splitarr+1] = msg:sub(u,nextanch-match:len())
  76.             if nextanch~=length then
  77.                 u = nextanch+match:len()
  78.             else
  79.                 u = lengthlua
  80.             end
  81.         else
  82.             splitarr[#splitarr+1] = msg:sub(u,length)
  83.             u = length+1
  84.         end
  85.     end
  86.     return splitarr
  87. end
  88.  
  89. windower.register_event('action',function (act)
  90.     local actor = act.actor_id
  91.     local category = act.category
  92.     local player = windower.ffxi.get_player()
  93.    
  94.     if ((actor == (player.id or player.index))) then
  95.         if category == 2 then
  96.             if auto == 1 then
  97.                 if  player.status == 1 then
  98.                     auto = 1
  99.                 elseif  player.status == 0 then
  100.                     auto = 0
  101.                 end
  102.             end
  103.            
  104.             if auto == 1 then
  105.                 windower.send_command('@wait 1.5;input /shoot <t>')
  106.             elseif auto == 0 then
  107.             end
  108.         end
  109.     end
  110. end)
  111.  
  112. --Function Designer:  Byrth
  113. windower.register_event('addon command',function (...)
  114.     local term = table.concat({...}, ' ')
  115.     local splitarr = split(term,' ')
  116.     if splitarr[1]:lower() == 'start' then
  117.         start()
  118.     elseif splitarr[1]:lower() == 'stop' then
  119.         stop()
  120.     elseif splitarr[1]:lower() == 'shoot' then
  121.         shoot()
  122.     elseif splitarr[1]:lower() == 'reload' then
  123.         setDelay()
  124.     elseif splitarr[1]:lower() == 'help' then
  125.         windower.add_to_chat(17, 'AutoRA  v'..version..'commands:')
  126.         windower.add_to_chat(17, '//ara [options]')
  127.         windower.add_to_chat(17, '    start  - Starts auto attack with ranged weapon')
  128.         windower.add_to_chat(17, '    stop   - Stops auto attack with ranged weapon')
  129.         windower.add_to_chat(17, '    help   - Displays this help text')
  130.         windower.add_to_chat(17, ' ')
  131.         windower.add_to_chat(17, 'AutoRA will only automate ranged attacks if your status is "Engaged".  Otherwise it will always fire a single ranged attack.')
  132.         windower.add_to_chat(17, 'To start auto ranged attacks without commands use the key:  Ctrl+d')
  133.         windower.add_to_chat(17, 'To stop auto ranged attacks in the same manner:  Atl+d')
  134.     end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement