stun command is sent with elite
sometimes, stun is not executed
maybe i have issue with this third party tool so i made a small addon
V1 :
Code: Select all
_addon.author = 'Moi';
_addon.name = 'moistun';
_addon.version = '1.0';
require 'common'
---------------------------------------------------------------------------------------------------
-- func: newchat
-- desc: Called when a new line is incoming in chatlog.
---------------------------------------------------------------------------------------------------
ashita.register_event('newchat', function(mode, chat)
line = chat:lower();
-- remove ashita timestamp if they exist
if (line:sub( 3, 3 ) == '[' and line:sub( 12, 12 ) == ']') then
line = chat:lower():sub( 16, 500 );
end
a = string.find(line, 'mnyiri');
b = string.find(line, 'readies');
c = string.find(line, 'bewitching lantern');
d = string.find(line, 'hypnic lamp');
if (a ~= nil) then
if (b ~= nil) then
if (c ~= nil) then
print('stun');
AshitaCore:GetChatManager():ParseCommand('/ja "violent flourish" <t>', 1);
end
if (d ~= nil) then
print('stun');
AshitaCore:GetChatManager():ParseCommand('/ja "violent flourish" <t>', 1);
end
end
end
end );
i got the "stun" message from print command
i think it's the ParseCommand which sometimes is not executed
i made a V2 with a different strategy
V2 is going to spam ParseCommand for 7s
this way, if the first ParseCommand fail, the 2nd or third or others will be executed
V2 :
Code: Select all
_addon.author = 'Moi';
_addon.name = 'moistun';
_addon.version = '1.0';
require 'common'
local stun = 0;
---------------------------------------------------------------------------------------------------
-- func: Render
-- desc: Called when our addon is rendered.
---------------------------------------------------------------------------------------------------
ashita.register_event('render', function()
if ( stun == 1 ) then
if ( os.time() < stun_date +7 ) then
AshitaCore:GetChatManager():ParseCommand('/ja "violent flourish" <t>', 1);
else
stun = 0;
print("stun end");
end
end
end );
---------------------------------------------------------------------------------------------------
-- func: newchat
-- desc: Called when a new line is incoming in chatlog.
---------------------------------------------------------------------------------------------------
ashita.register_event('newchat', function(mode, chat)
line = chat:lower();
-- remove ashita timestamp if they exist
if (line:sub( 3, 3 ) == '[' and line:sub( 12, 12 ) == ']') then
line = chat:lower():sub( 16, 500 );
end
--print('::'..line);
a = string.find(line, 'mnyiri');
b = string.find(line, 'readies');
c = string.find(line, 'bewitching lantern');
d = string.find(line, 'hypnic lamp');
if (a ~= nil) then
if (b ~= nil) then
if (c ~= nil) then
print('stun start');
stun_date = os.time();
stun = 1;
end
if (d ~= nil) then
print('stun start');
stun_date = os.time();
stun = 1;
end
end
end
end );
i got the 'stun start' and 'stun end' message but sometimes, clearly, none of the commands are executed
9 times on 10, i know commands are executed because i got message error relative to recast ability in chatlog
unfortunately, 1 time on 10, none of the commands are executed
am i doing something wrong ?