Hi everyone,
today I was trying to add lua calling to my bot but I was not even close. WoW is crashing all the time. I was trying the following with BlackMagic.
Code:
public void Lua_DoString(string command)
{
// command is something like "DoEmote(\"dance\")"
uint codecave = magic.AllocateMemory();
uint stringcave = magic.AllocateMemory();
magic.Asm.AddLine("fs mov eax, [0x2C]");
magic.Asm.AddLine("mov eax, [eax]");
magic.Asm.AddLine("add eax, 0x10");
magic.Asm.AddLine("mov dword [eax], {0}", com.getMgr());
magic.Asm.AddLine("mov eax, 0");
magic.Asm.AddLine("push eax");
magic.Asm.AddLine("mov eax, {0}", stringcave);
magic.Asm.AddLine("push eax");
magic.Asm.AddLine("push eax");
magic.Asm.AddLine("call {0}", 0x0049AAB0);
magic.Asm.AddLine("add esp, 0xC");
magic.Asm.AddLine("retn");
magic.Asm.InjectAndExecute(codecave);
magic.FreeMemory(codecave);
magic.FreeMemory(stringcave);
magic.ResumeThread();
}
After this WoW says goodbye.
Does anybody here could provide examples of calling lua functions via BlackMagic and getting the results back into your code?