Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- timeit = require 'timeit'
- windower.register_event('addon command',function (...)
- command = table.concat({...},' ')
- if command:lower() == 'test' then
- if testmode then
- testmode = false
- table.sort(timearray)
- local basetime = 25
- windower.add_to_chat(8,'------ Delays ------')
- for i,v in ipairs(timearray) do
- windower.add_to_chat(8,tostring(v))
- if v < basetime then
- basetime = v
- end
- end
- windower.add_to_chat(121,'TP Delay should be set to about: '..basetime-0.4) -- 0.3 seconds longer than necessary.
- else
- testmode = true
- timearray = {}
- windower.add_to_chat(121,'Start shooting as fast as you possibly can.\7 Really try to spam the shit out of it.')
- end
- end
- end)
- windower.register_event('load',function ()
- --- You edit this ---
- pause_for_ws = false
- TPdelay = 0.35
- preshot_script = 'preshot.txt'
- midshot_script = 'midshot.txt'
- aftershot_script = 'aftershot.txt'
- --- Don't edit this ---
- testmode = false
- failurelimit = 3
- autoshot = false
- failurecount = 0
- radelay = 0.7
- wsdelay = 1.7
- Cancel_delay = 1
- windower.send_command('bind ^d lua i makeshot startshooting')
- windower.send_command('alias ms lua c makeshot')
- end)
- windower.register_event('unload', function ()
- windower.send_command('unalias ms')
- windower.send_command('unbind ^d')
- end)
- windower.register_event('action',function (act)
- local player = windower.ffxi.get_player()
- if player['id'] ~= act['actor_id'] then return end
- if act['category'] == 12 and act['param'] == 24931 then
- -- windower.add_to_chat(121,'Aiming a ranged attack!')
- if windower.file_exists(windower.windower_path .. 'scripts/'..midshot_script) then
- windower.send_command('exec '..midshot_script)
- end
- if testmode and ttime then
- timearray[#timearray+1] = ttime:stop()
- end
- elseif act['category'] == 12 and act['param'] == 28787 then
- if autoshot then
- failurecount = failurecount +1
- if failurecount >= 3 then
- autoshot = false
- failurecount = 0
- windower.add_to_chat(5,'3 Shot failures. Autoshot Canceled. Control D to restart')
- else
- windower.send_command('wait '..Cancel_delay..';lua i makeshot checktp')
- end
- end
- if windower.file_exists(windower.windower_path .. 'scripts/'..aftershot_script) then
- windower.send_command('exec '..aftershot_script)
- end
- elseif act['category'] == 2 then -- Shot Landing
- failurecount = 0
- if autoshot then
- windower.send_command('wait '..TPdelay..';lua i makeshot checktp')
- end
- if testmode then
- ttime = timeit.new()
- ttime:start()
- end
- if windower.file_exists(windower.windower_path .. 'scripts/'..aftershot_script) then
- windower.send_command('exec '..aftershot_script)
- end
- elseif act['category'] == 3 and pause_for_ws then -- WS Landing
- if autoshot then
- windower.add_to_chat(121,'Autoshot resumed!')
- windower.send_command('wait '..(wsdelay+TPdelay)..';lua i makeshot checktp')
- end
- end
- end)
- function startshooting()
- if autoshot or not windower.ffxi.get_mob_by_target('<t>') then
- autoshot = false
- else
- autoshot = true
- if windower.file_exists(windower.windower_path .. 'scripts/'..preshot_script) then
- windower.send_command('exec '..preshot_script)
- end
- windower.send_command('wait '..radelay..';input /ra <t>;')
- end
- end
- function checktp()
- local player = windower.ffxi.get_player()
- if (player.vitals.tp < 100 and autoshot) or (not pause_for_ws and autoshot) then
- if windower.file_exists(windower.windower_path .. 'scripts/'..preshot_script) then
- windower.send_command('exec '..preshot_script)
- end
- windower.send_command('wait '..radelay..';input /ra <t>')
- elseif player.vitals.tp >= 100 and autoshot and pause_for_ws then
- windower.add_to_chat(121,'Autoshot canceled, WS away!')
- end
- end
- windower.register_event('action message',function (actor_id,target_id,actor_index,target_index,message_id,param_1,param_2,param_3)
- if message_id == 94 then
- if autoshot then
- failurecount = failurecount +1
- if failurecount >= 3 then
- autoshot = false
- failurecount = 0
- windower.add_to_chat(5,j..'3 Shot failures. Autoshot Canceled. Control D to restart')
- else
- windower.send_command('wait '..Cancel_delay..';input /ra <t>;')
- -- windower.send_command('wait '..Cancel_delay..';lua i makeshot checktp')
- end
- end
- if windower.file_exists(windower.windower_path .. 'scripts/'..aftershot_script) then
- windower.send_command('exec '..aftershot_script)
- end
- elseif message_id == 216 then
- send_command('@input /equip ammo "Dart" <me>;wait 1;input /ra <t>;')
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement