Help With A Script

Langues: JP EN DE FR
users online
Forum » Windower » General » Help with a script
Help with a script
Offline
Posts: 12231
By Pantafernando 2014-09-23 04:09:49
Link | Citer | R
 
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
Offline
Serveur: Bahamut
Game: FFXI
user: Smg1388
Posts: 39
By Bahamut.Ivebian 2014-09-23 07:22:33
Link | Citer | R
 
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
Offline
Serveur: Bahamut
Game: FFXI
user: Smg1388
Posts: 39
By Bahamut.Ivebian 2014-09-24 08:34:50
Link | Citer | R
 
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.
[+]
Offline
Posts: 12231
By Pantafernando 2014-09-24 10:49:30
Link | Citer | R
 
Bahamut.Ivebian said: »
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.

Thanks for the script. I really appreciate.
 Leviathan.Arcon
VIP
Offline
Serveur: Leviathan
Game: FFXI
user: Zaphor
Posts: 660
By Leviathan.Arcon 2014-09-24 11:27:45
Link | Citer | R
 
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
Offline
Serveur: Bahamut
Game: FFXI
user: Smg1388
Posts: 39
By Bahamut.Ivebian 2014-09-24 16:46:14
Link | Citer | R
 
Thanks for the tip, Arcon. Keep them coming ;)
necroskull Necro Bump Detected! [319 days between previous and next post]
Offline
Posts: 634
By zaxtiss 2015-08-09 23:43:01
Link | Citer | R
 
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
Log in to post.