|
Help with a script
By Pantafernando 2014-09-23 04:09:49
Hi.
I would like some directions to write a script, or if what i want cant be done with scripts, some hints to implement that on spellcast/windower.
Basically i have problems when i need to send command to my mule to help me in battle. Ive been using ingame macros:
/console send mule /assist player <wait 1>
/console send mule /attack
That macro works, but it has 2 problems: first one is when, for some reason, sometimes (and quite often) the second line is ignored, so i need to hit a second time the macro.
Second, more troublesome, is when the macros works, but the animation takes some time, and i end hitting the macro a second time. But as the macro worked in first time, resending /attack will force mule to disengage.
Those manual corrections can take few secs but, depending on content, can increase a lot the odds of failing, so basically, what i need is to make a functional if comand that do:
/console send mule /assist player <wait 1>
If status = disengaged
/attack
If status = engaged
Do nothing.
This way, i can spam the macro to make sure the mule will assist and attack without the downside of disengage if the mule was engaged beforehand.
Any help to implement this i appreciate.
Thanks in advance.
Bahamut.Ivebian
Server: Bahamut
Game: FFXI
Posts: 39
By Bahamut.Ivebian 2014-09-23 07:22:33
Instead you could use "/attack on" and "/attack off" or the shortened version "/a on" and "/a off", to counter this.
You can also use ";" to separate commands and fit more in one line:
/console send mule /assist player;wait 1;send mule /a on;
You could do the check you're asking for in a simple lua script too.
I just woke up but ill post something tonight if no one beats me and you're still interested.
[+]
Bahamut.Ivebian
Server: Bahamut
Game: FFXI
Posts: 39
By Bahamut.Ivebian 2014-09-24 08:34:50
You can save and load this as an addon. It only needs to be loaded on your main characters instance. Command is //assister mule_name or in a macro: /con assister mule_name. Top one does only what you asked for. The bottom one is slightly modified, It checks your status and your mule's status when commanded and sends assist+attack if your main is engaged and mule is not. If both characters are disengaged it sends mule a follow command, if main is not engaged and mule is engaged it sends "/attack off", all using the same command //assister mule_name.
Code _addon.command = 'assister'
windower.register_event('addon command', function(...)
local name = table.concat({...})
if name ~= nil then
local main_p = windower.ffxi.get_player()
local alt_p = windower.ffxi.get_mob_by_name(name)
if main_p.status == 1 and alt_p.status == 0 then
str = 'send '..alt_p.name..' /assist '..main_p.name..';wait 1;send '..alt_p.name..' /a on;'
windower.send_command(str)
end
end
end) Code _addon.command = 'assister'
windower.register_event('addon command', function(...)
local name = table.concat({...})
if name ~= nil then
local main_p = windower.ffxi.get_player()
local alt_p = windower.ffxi.get_mob_by_name(name)
--Send mule_name assist and attack when main engaged and mule idle
if main_p.status == 1 and alt_p.status == 0 then
str = 'send '..alt_p.name..' /assist '..main_p.name..';wait 1;send '..alt_p.name..' /a on;'
--Send mule_name follow if main and mule is idle. Status for riding a chocobo is 5.
elseif main_p.status == 0 and alt_p.status == 0 then
str = 'send '..alt_p.name..' /follow '..main_p.name..';'
--disengage alt if main is not engaged.
elseif main_p.status == 0 and alt_p.status == 1 then
str = 'send '..alt_p.name..' /a off;'
end
if str then
windower.send_command(str)
end
end
end)
[+]
By Pantafernando 2014-09-24 10:49:30
You can save and load this as an addon. It only needs to be loaded on your main characters instance. Command is //assister mule_name or in a macro: /con assister mule_name. Top one does only what you asked for. The bottom one is slightly modified, It checks your status and your mule's status when commanded and sends assist+attack if your main is engaged and mule is not. If both characters are disengaged it sends mule a follow command, if main is not engaged and mule is engaged it sends "/attack off", all using the same command //assister mule_name.
Code _addon.command = 'assister'
windower.register_event('addon command', function(...)
local name = table.concat({...})
if name ~= nil then
local main_p = windower.ffxi.get_player()
local alt_p = windower.ffxi.get_mob_by_name(name)
if main_p.status == 1 and alt_p.status == 0 then
str = 'send '..alt_p.name..' /assist '..main_p.name..';wait 1;send '..alt_p.name..' /a on;'
windower.send_command(str)
end
end
end) Code _addon.command = 'assister'
windower.register_event('addon command', function(...)
local name = table.concat({...})
if name ~= nil then
local main_p = windower.ffxi.get_player()
local alt_p = windower.ffxi.get_mob_by_name(name)
--Send mule_name assist and attack when main engaged and mule idle
if main_p.status == 1 and alt_p.status == 0 then
str = 'send '..alt_p.name..' /assist '..main_p.name..';wait 1;send '..alt_p.name..' /a on;'
--Send mule_name follow if main and mule is idle. Status for riding a chocobo is 5.
elseif main_p.status == 0 and alt_p.status == 0 then
str = 'send '..alt_p.name..' /follow '..main_p.name..';'
--disengage alt if main is not engaged.
elseif main_p.status == 0 and alt_p.status == 1 then
str = 'send '..alt_p.name..' /a off;'
end
if str then
windower.send_command(str)
end
end
end)
Thanks for the script. I really appreciate.
Leviathan.Arcon
VIP
Server: Leviathan
Game: FFXI
Posts: 682
By Leviathan.Arcon 2014-09-24 11:27:45
Just fyi, you can shorten the two scripts a little, there's a bit of redundant code in there. Here's an example for the first one Code _addon.command = 'assister'
windower.register_event('addon command', function(name)
local self = windower.ffxi.get_player()
if self.status == 1 and windower.ffxi.get_mob_by_name(name).status == 0 then
windower.send_command('send %s /assist %s; wait 1; send %s /a on':format(name, self.name, name))
end
end)
Bahamut.Ivebian
Server: Bahamut
Game: FFXI
Posts: 39
By Bahamut.Ivebian 2014-09-24 16:46:14
Thanks for the tip, Arcon. Keep them coming ;)
Necro Bump Detected!
[319 days between previous and next post]
By zaxtiss 2015-08-09 23:43:01
hey is it possible to have it so when your mule is engaged that your main will attack to help it cuz sometimes i wont notice if theres to much chat spam
Hi.
I would like some directions to write a script, or if what i want cant be done with scripts, some hints to implement that on spellcast/windower.
Basically i have problems when i need to send command to my mule to help me in battle. Ive been using ingame macros:
/console send mule /assist player <wait 1>
/console send mule /attack
That macro works, but it has 2 problems: first one is when, for some reason, sometimes (and quite often) the second line is ignored, so i need to hit a second time the macro.
Second, more troublesome, is when the macros works, but the animation takes some time, and i end hitting the macro a second time. But as the macro worked in first time, resending /attack will force mule to disengage.
Those manual corrections can take few secs but, depending on content, can increase a lot the odds of failing, so basically, what i need is to make a functional if comand that do:
/console send mule /assist player <wait 1>
If status = disengaged
/attack
If status = engaged
Do nothing.
This way, i can spam the macro to make sure the mule will assist and attack without the downside of disengage if the mule was engaged beforehand.
Any help to implement this i appreciate.
Thanks in advance.
|
|