Windower / Issues

Windower Public Issue Tracker
31 stars 21 forks source link

Possible windower.send_ipc_message bug or I'm going insane. #1023

Open amadeus1171 opened 5 years ago

amadeus1171 commented 5 years ago

Can someone private message me? I'll send the entire code. But in the interim, I'll post the problematic code.

for some reason process_ipc(msg) never gets called. Am I going crazy, or is something actually bugged?

A little bit of history:

This bit of code worked before, then I quit for a bit. And when I came back it stopped working. What changed? ` table = require('tables') packets = require('packets')

other_player_jobs = T{}

function process_ipc(msg) windower.add_to_chat(5, 'process_ipc here!') local args = T{} local cmd = "" local sender = nil local player = windower.ffxi.get_player() local invalid_sender = (player and player.name) or "invalid"

if player.main_job ~= 'PUP' then return end

-- Parse the message into arguments
for arg in string.gmatch(msg, "%S+") do
    args[#args+1] = arg
end

if args[1] then
    sender = args[1]
end

-- Don't process messages from ourself
if player == nil or sender == nil or sender == player.name then return end

if args[2] then
    cmd = args[2]
end

if cmd == "job_update" then
-- job_update
-- From main sub
    if args[3] and args[4] and sender then
        if not other_player_jobs[sender] then
            other_player_jobs[sender] = {}
        end
        other_player_jobs[sender]["main"] = args[3]
        other_player_jobs[sender]["sub"]  = args[4]
    end
elseif cmd == "deploy_target" then
    -- See if we're supposed to assist this job
    -- target_id
    -- target_index
    if sender == auto_assist_deploy_who and args[3] and args[4] then
        assist_target_id = tonumber(args[3])
        assist_target_index = tonumber(args[4])
        do_auto_assist_deploy()
    end
end

end

windower.register_event('ipc message', process_ipc)

windower.register_event('outgoing chunk', function(id, original, modified, injected, blocked) -- Look for the /pet deploy message and send an ipc message to all the other puppet_master helpers that I'm deploying -- on this mob if id == 0x01A then local packet = packets.parse("outgoing", original) --windower.add_to_chat(5, table.tostring(packet)) if packet.Category == 9 and T{69,88,138}:contains(packet.Param) then local tmpmsg = windower.ffxi.get_player().name .. ' deploy_target ' .. tostring(packet['Target']) .. ' ' .. tostring(packet['Target Index']) windower.send_ipc_message(tmpmsg) end end end) `

amadeus1171 commented 5 years ago

In a new addon called "test" I have pasted the above code and it works. In problematic addon I have cut out all other code so it resembles the above code and it does not work.

Seriously, am I loosing my mind?!

amadeus1171 commented 5 years ago

What?! WHAT?!

I copied the entire bugged addon to the test and addon and it worked...

What... The... Actual... fluck?!

amadeus1171 commented 5 years ago

So, I renamed the borked plugin to _borked and renamed the test plugin to the original name of the borked plugin and it stopped working.

Is someone f'in' with me?

amadeus1171 commented 5 years ago

Now I renamed the addon to a shortened name: pup_helper from puppetmaster_helper and it worked. Who's f'in' with me?!

Either someone is f'in with me or we're having a buffer overrun error occuring because the addon name is too long.

cairthenn commented 5 years ago

Addons communicating via IPC need to be named the same. Make sure you're reloading on both processes.

cairthenn commented 5 years ago

Closed by mistake

amadeus1171 commented 5 years ago

Come on Cair. Don't you know who you're talking to? Of course they're the same process/addon names! This is Malthar.

Check the code that stores the addon name. How long is it? I'm 99.2% sure you'll find an error in that.

amadeus1171 commented 5 years ago

And if the addon name is to be standardized to a quantum length then the addon should throw an exception if the name is too long.