MMOMinion

Full Version: ffxiv_task_ vs onupdate handler.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
does this still work ?
im trying to add a cne to an existing task.

it works fine adding it into the tasks init function
but not from the module init function.

was the code removed that checked the superclass for more cnes ?
Code:
function wim.ModuleInit()
  ke_ntcne = ml_element:create( "ntcne", c_ntcne, e_ntcne, 28)
  ffxiv_task_assist.add(    ke_ntcne, ffxiv_task_assist.process_elements)
end
ffxiv_task_assist.add vs ffxiv_task_assist:add
(12-14-2014, 05:41 PM)Ace Wrote: [ -> ]ffxiv_task_assist.add vs ffxiv_task_assist:add

i had it ffxiv_task_assist:add

Code:
function wim.ModuleInit()
  d(TableSize(ffxiv_task_assist.process_elements)) -- prints 0
  ke_ntcne = ml_element:create( "ntcne", c_ntcne, e_ntcne, 28)
  ffxiv_task_assist:add(    ke_ntcne, ffxiv_task_assist.process_elements)
  d(TableSize(ffxiv_task_assist.process_elements)) -- prints 1
end

it is added.
but its never checked or used?

im guessing this is where it checks the cne list:
Code:
function ml_cne_hub.eval_elements(elementList)
    for k, elem in pairs( elementList ) do
        if (gLogCNE == "1") then
            ml_debug( "Evaluating:" .. tostring( elem.name ) )
        end
        elem.eval = elem:evaluate()
    if (gLogCNE == "1") then
            ml_debug( elem.name .. " evaluation result:" .. tostring( elem.eval ) )
        end
    end
end

i dont know Lua at all but it looks to me
this function is called once only with the instanced version of the object.

Code:
function ml_task:Process()
    if (TableSize(self.process_elements) > 0) then
        ml_cne_hub.clear_queue()
        ml_cne_hub.eval_elements(self.process_elements) --  <<< here

        ml_cne_hub.queue_to_execute()
        ml_cne_hub.execute()
        return false
    else
        ml_debug("no elements in process table")
    end
end

in this thread a dev said he added specific code. i dont see it ?
Is there a new way to do it ?

EDIT:
btw i used to add it like this
Code:
init_ntcne = false
function wim.doPulse( Event, ticks )
  if ml_task_hub:CurrentTask() and not init_ntcne then
    ke_ntcne = ml_element:create( "ntcne", c_ntcne, e_ntcne, 28)
    ml_task_hub:CurrentTask():add(ke_ntcne, ml_task_hub:CurrentTask().process_elements)
    init_ntcne = true
  end
end
which is basically waiting for a task to be created ( by press bot enabled etc.. )
and then add it to that.
but i would much rather have the solution the dev mentioned in this thread
Are you making sure that your module.def has FFXIVMINION as a dependency? It sounds like your module is loading before the FFXIVMINION, because if you look at ffxiv_task_assist, it has something like 8 or 9 process elements.
(12-14-2014, 07:38 PM)Ace Wrote: [ -> ]Are you making sure that your module.def has FFXIVMINION as a dependency? It sounds like your module is loading before the FFXIVMINION, because if you look at ffxiv_task_assist, it has something like 8 or 9 process elements.

i want to put cne into a task.
i can only put it in there, once the task is instantiated.

the tasks are coded into an array as class files.
a)bot gets initiated
b)the modules get initiated << here i want to add cne
c)bot starts running / bot sets the mode / instantiates the task << here only can i add cne

and so as a workaround the dev said
"instead of adding it to the instance you can add it to the class file
and the code now looks there for cne's too"

so yes the class file has 0 elements <<< im adding my cne here.
and the instantiated object has 9 or so <<< cant add it here cause it doesnt exist on mudule init.
For what you're trying to do, you need to override the ffxiv_task_assist:Init() function with a copy of your own in your module, with your cne added.

When your module gets loaded, the modified version of the function in your module will be the Init() that gets run.
(12-14-2014, 09:41 PM)Ace Wrote: [ -> ]For what you're trying to do, you need to override the ffxiv_task_assist:Init() function with a copy of your own in your module, with your cne added.

When your module gets loaded, the modified version of the function in your module will be the Init() that gets run.

if they change that function, i would have to reflect that in my copy.
i dont like that. i rather add it at runtime then.
It is what it is. :)
Pages: 1 2