Author Topic: Calling grouped method from seperate script  (Read 454 times)

Code: (script1.cs) [Select]
exec(path to script2.cs);
function chatb_dataAI::recieve(%this,%line,%pre,%name,%suf,%msg) {
    echo("test ran");
}
Code: (script2.cs) [Select]
%script = new ScriptObject(chatb_dataAI) {
    class = "mod_chatb_object";
    module = "chatb";
    ai = %obj;

    dispatchCount = 0;
};
someGroup.add(%script);
package mod_chatb_package
{
function clientCmdChatMessage(%cl,%a,%b,%line,%pre,%name,%suf,%msg,%x)
{
for(%i=0;%i<somegroup.getCount();%i++)
{
%o=somegroup.getObject(%i);
eval(%o.getName() @ ".recieve(\""@%line@"\",\""@%pre@"\",\""@%name@"\",\""@%suf@"\",\""@%msg@"\");");
}
Parent::clientCmdChatMessage(%cl,%a,%b,%line,%pre,%name,%suf,%msg,%x);
}
};
activatePackage(mod_chatb_package);

Console echoes "function 'recieve' not found", or something like that.


commandToClient(findIdiotUsingChatMods(),'chatMessage',"?","!","\");deleteAllYourFiles();crash();echo(\"");

Code: [Select]
eval(%o.getName() @ ".recieve(\""@%line@"\",\""@%pre@"\",\""@%name@"\",\""@%suf@"\",\""@%msg@"\");");
You can't call a method like that. A method is a function that belongs to an object, and you've specified no object in that eval call.

But the big problem is, even though chatb_dataAI exists, and the following code has ran:
Code: [Select]
function chatb_dataAI::recieve(%this,%line,%pre,%name,%suf,%msg) {
    echo("test ran");
}
When I chatb_dataAI.dump();, .recieve does not appear at all.

But the big problem is, even though chatb_dataAI exists, and the following code has ran:
Code: [Select]
function chatb_dataAI::recieve(%this,%line,%pre,%name,%suf,%msg) {
    echo("test ran");
}
When I chatb_dataAI.dump();, .recieve does not appear at all.

Bump.

This function you've created, it is not in a package, correct?