|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Daavid How do I cheat? Reputation: 0
Joined: 03 Jul 2012 Posts: 4
|
Posted: Thu Jul 05, 2012 7:04 am Post subject: d3d hook in trainer |
|
|
hello, I'm new to lua but I manage to make an text and colored background in a dx9 game.
Then I used Lua in cheatengine it auto turned on "Hook Direct3D" because it knew I was using it..
But now then I make my trainer using the same code that worked in CE I get the "Error:The d3dhook object has not been created yet"
Isnt it posible for the trainer to turn that on? How can I use d3d hook in a trainer?
Cheers!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25294 Location: The netherlands
|
Posted: Thu Jul 05, 2012 8:05 am Post subject: |
|
|
Is it a tiny trainer or a gigantic trainer?
If gigantic, you must add all required dll's to your trainer when building the exe (all d3d related dll's, but you can skip the dx10 and 11)
_________________
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 |
|
|
Daavid How do I cheat? Reputation: 0
Joined: 03 Jul 2012 Posts: 4
|
Posted: Thu Jul 05, 2012 8:34 am Post subject: |
|
|
Dark Byte wrote: | Is it a tiny trainer or a gigantic trainer?
If gigantic, you must add all required dll's to your trainer when building the exe (all d3d related dll's, but you can skip the dx10 and 11) |
I have tried gigantic and tiny now. Same thing on both :/
for example using this menu code you made in a trainer:
How to show an ingame menu in d3d games
I get the same error..
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25294 Location: The netherlands
|
Posted: Thu Jul 05, 2012 8:43 am Post subject: |
|
|
Does your lua script contain code to attach to the game ?
When you use it as a ct you might have opened the process manually, but in a trainer you have to code it so it does that.
Also, check http://forum.cheatengine.org/viewtopic.php?t=553143 , note that there is a delay between opening the process and starting the hook
_________________
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 |
|
|
Daavid How do I cheat? Reputation: 0
Joined: 03 Jul 2012 Posts: 4
|
Posted: Thu Jul 05, 2012 11:00 am Post subject: |
|
|
Dark Byte wrote: | Does your lua script contain code to attach to the game ?
When you use it as a ct you might have opened the process manually, but in a trainer you have to code it so it does that.
Also, check (cant post urls) , note that there is a delay between opening the process and starting the hook |
You mean like this?
"strings_add(getAutoAttachList(), "GAME.exe")"
everything works great if I just put the code in Lua in CE. It just dont work in a trainer because the hook Direct3D function doesnt get enabled..
I cant see anthing in that ingame trainer code that I missed.
But if we just wanted to be able to use this code you posten:
This will work if I just put it in to Lua and run it. But if I then use the "Generate trainer from Lua table".
use gigantic/tiny or whatever settings (I have tried them all)
and then save it as an EXE and try it out. I will still get this error..
And I cant see why this is a problem because I need CE to start the trainer so why would it be a difference to run it as a trainer or just paste the Lua code?
or what am I missing here?
because this down here will work, but not if i make it to a trainer..
Code: |
strings_add(getAutoAttachList(), "GAME.exe")
background=createPicture()
bmp=picture_getBitmap(background);
graphic_setHeight(bmp,1)
graphic_setWidth(bmp,1)
c=rasterimage_getCanvas(bmp)
canvas_setPixel(c,0,0,0xff0000)
highlighter=createPicture()
bmp=picture_getBitmap(highlighter);
graphic_setHeight(bmp,1)
graphic_setWidth(bmp,1)
c=rasterimage_getCanvas(bmp)
canvas_setPixel(c,0,0,0x0000ff)
d3dhook_initializeHook()
bgtexture=d3dhook_createTexture(background)
bgsprite=d3dhook_createSprite(bgtexture);
d3dhook_renderobject_setX(bgsprite, -1) --center it horizontally
d3dhook_sprite_setWidth(bgsprite,200)
d3dhook_sprite_setHeight(bgsprite,200)
highlightertexture=d3dhook_createTexture(highlighter)
hlsprite=d3dhook_createSprite(highlightertexture)
d3dhook_renderobject_setVisible(hlsprite, false) --don't show it just yet
d3dhook_renderobject_setX(hlsprite, -1) --center (so matches with the background)
d3dhook_sprite_setWidth(hlsprite,200)
font=createFont()
fontmap=d3dhook_createFontmap(font)
lineheight=d3dhook_texture_getHeight(fontmap) --fontmap inherits from texture so this can be used
d3dhook_sprite_setHeight(hlsprite,lineheight) --make the highlightr the same height as a textline
Option1=d3dhook_createTextContainer(fontmap,-1,50,'Option 1: OFF')
Option2=d3dhook_createTextContainer(fontmap,-1,50+lineheight,'Option 2: OFF')
Option3=d3dhook_createTextContainer(fontmap,-1,50+lineheight*2,'Option 3: OFF')
Option1State=false
Option2State=false
Option3State=false
selectedOption=1
function setHighlighterToSelectedOption()
d3dhook_renderobject_setY(hlsprite, 50+lineheight*(selectedOption-1))
end
setHighlighterToSelectedOption()
d3dhook_renderobject_setVisible(hlsprite, true)
function ExecuteSelectedOption()
local onoff="OFF";
if (selectedOption==1) then
Option1State=not Option1State
if (Option1State) then
onoff="ON"
else
onoff="OFF"
end
d3dhook_textcontainer_setText(Option1,'Option 1: '..onoff);
end
if (selectedOption==2) then
Option2State=not Option2State
if (Option2State) then
onoff="ON"
else
onoff="OFF"
end
d3dhook_textcontainer_setText(Option2,'Option 2: '..onoff);
end
if (selectedOption==3) then
Option3State=not Option3State
if (Option3State) then
onoff="ON"
else
onoff="OFF"
end
d3dhook_textcontainer_setText(Option3,'Option 3: '..onoff);
end
end
function objectclick(object, x, y)
--bla=userDataToInteger(object)
--print(string.format("click on %x",bla))
if (object==Option1) then
selectedOption=1
ExecuteSelectedOption()
end
if (object==Option2) then
selectedOption=2
ExecuteSelectedOption()
end
if (object==Option3) then
selectedOption=3
ExecuteSelectedOption()
end
setHighlighterToSelectedOption()
end
d3dhook_onClick(objectclick)
function keydown(virtualkey,char)
if (virtualkey==VK_DOWN) then
--down arrow
if (selectedOption<3) then
selectedOption=selectedOption+1
end
end
if (virtualkey==VK_UP) then
--up arrow
if (selectedOption>1) then
selectedOption=selectedOption-1
end
end
if (virtualkey==VK_RETURN) then
ExecuteSelectedOption()
end
setHighlighterToSelectedOption()
return true
end
d3dhook_onKey(keydown) |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25294 Location: The netherlands
|
Posted: Thu Jul 05, 2012 12:19 pm Post subject: |
|
|
never use "generate generic lua trainerscript from table", that will add a form and other code to your trainer that you probably do not want
just save as exe
Also, add some debug output using print so you can see where it goes wrong
And obviously, your script will not work because it will try to do the hooking before it has opened the process
Code: |
strings_add(getAutoAttachList(), "GAME.exe")
|
does not attach to the game at once, it just tells ce to attach to the game whenever it feels like
_________________
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 |
|
|
Daavid How do I cheat? Reputation: 0
Joined: 03 Jul 2012 Posts: 4
|
Posted: Thu Jul 05, 2012 3:51 pm Post subject: |
|
|
Dark Byte wrote: |
Code: |
strings_add(getAutoAttachList(), "GAME.exe")
|
does not attach to the game at once, it just tells ce to attach to the game whenever it feels like |
ah I see, I got it working
Thanks for your help, I really appreciate it
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|