View previous topic :: View next topic |
Author |
Message |
redplug How do I cheat? Reputation: 0
Joined: 20 Jun 2012 Posts: 9
|
Posted: Thu Jun 21, 2012 5:29 am Post subject: How to load a CE table from a plugin? |
|
|
Hi,
I am writing a plugin for CE with Lazarus and want to load a CE table from a file (or even better from a resource).
Is this possible with the SDK? |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Thu Jun 21, 2012 7:09 am Post subject: |
|
|
It's possible to a certain degree, but you might want to rethink what you're doing.
Why would you wish to load a table with a plugin, why not just use the hardcoded data internally instead of adding some stuff no one will see to the table ? (you hide the ce window)
Anyhow, you could make use of createTableEntry followed by the memrec_ functions to configure the added entries.
If you really want to use a cheat table you will then have to parse the xml data into commands to configure the table
An alternative method is to call lua's loadTable function. Just write the table to a temp dir and load.
(read http://forum.cheatengine.org/viewtopic.php?t=552839 and check the source. It makes use of ce's lua library to control the luavm object, you can use it to call lua functions as well )
If you just wish to execute an auto assemble script, then AutoAssembler(string) is a better solution _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
redplug How do I cheat? Reputation: 0
Joined: 20 Jun 2012 Posts: 9
|
Posted: Thu Jun 21, 2012 12:56 pm Post subject: |
|
|
Hi. Thanks for the reply.
Because it is easyer for me to debug and modify the table if the game gets patched.
but i found a way to do so. I have a Lua script:
Code: | ErrorLoadingWoWBot = true;
function WoWBotInitialized()
ErrorLoadingWoWBot = false;
startWoWBot();
end;
if startWoWBot == nil then
loadPlugin('wowbot.dll');
if ErrorLoadingWoWBot then
showMessage('Error loading wowbot.dll');
closeCE();
end
else
startWoWBot();
end |
and my wow bot dll:
Code: |
function StartWoWBot(L: PLua_State): integer; cdecl;
begin
Application.Initialize;
Application.CreateForm(TWoWBotForm, Form);
Application.Run();
CE.closeCE();
Result := 1;
end;
function InitializePlugin(ExportedFunctions: PExportedFunctions;
PluginId: DWord): BOOL; stdcall;
var
CallWoWBotInitialized: boolean;
begin
Result := False;
CE := ExportedFunctions^;
L := CE.GetLuaState();
if L <> nil then
begin
lua_register(L, 'startWoWBot', StartWoWBot);
lua_pushstring(L, 'WoWBotInitialized');
lua_rawget(L, LUA_GLOBALSINDEX);
CallWoWBotInitialized := lua_isfunction(L, -1);
lua_pop(L, 1);
if CallWoWBotInitialized then
begin
lua_getfield(L, LUA_GLOBALSINDEX, 'WoWBotInitialized');
lua_call(L, 0, 0);
end;
Result := True;
end;
end;
function GetVersion(var PluginVersion: TPluginVersion;
SizeOfPluginVersion: integer): BOOL; stdcall;
begin
Result := False;
if SizeOfPluginVersion <> SizeOf(TPluginVersion) then
exit;
PluginVersion.version := 1;
PluginVersion.pluginname := 'WoW Bot';
Result := True;
end;
function DisablePlugin: BOOL; stdcall;
begin
Result := True;
end;
|
and i created a CETRAINER file. this code solves also the problem with closing the form.
the best thing would be that i could create a exe from this woth CE. But it always say 'Error loading wowbot.dll' even if i add the wowbot.dll to the file list in CE. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Tue Jun 26, 2012 12:35 pm Post subject: |
|
|
you just have to specify the path to your plugin
Either TrainerOrigin if the plugin is separate but in the same folder as the trainer or getCheatEngineDir() if the plugin is inside the exe _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|