Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


D3D Hook question.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Fri Mar 17, 2017 6:20 pm    Post subject: D3D Hook question. Reply with quote

I want to create a button or image in game, and I found this tutorial by Dark Byte (http://forum.cheatengine.org/viewtopic.php?t=552281). However, after I enabled d3d hook and copied the code from DB's post, nothing happened when I clicked "Execute script" in the Lua script window. I changed nothing in the code example.

Did I do something wrong?

_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
usernotfound
Expert Cheater
Reputation: 0

Joined: 21 Feb 2016
Posts: 115

PostPosted: Sat Mar 18, 2017 9:06 am    Post subject: Reply with quote

Are you sure the game is using DirectX?

Try this

Code:
D3D   = createD3DHook()
BtImg = createPicture()
BtImg.loadFromFile(button_image) -- path or var containing your image
BtTex = D3D.createTexture(BtImg)
BtSpr = D3D.createSprite(BtTex)

BtSpr.x = 1
BtSpr.y = 1

D3D.OnClick = function()
  -- do stuff
end
Back to top
View user's profile Send private message
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Sun Mar 19, 2017 2:00 am    Post subject: Reply with quote

usernotfound wrote:
Are you sure the game is using DirectX?

Try this

Code:
D3D   = createD3DHook()
BtImg = createPicture()
BtImg.loadFromFile(button_image) -- path or var containing your image
BtTex = D3D.createTexture(BtImg)
BtSpr = D3D.createSprite(BtTex)

BtSpr.x = 1
BtSpr.y = 1

D3D.OnClick = function()
  -- do stuff
end


Yes, I double checked it, it uses DirectX 9.0c.

Do I have to do anything else other than copy and paste your code to the LUA Script window? Your code does not work, just like DB's. Sad

The game is a single player game on steam, and I put it into window mode when I play it.

BTW, I don't know if this matters, the "set custom crosshair" function also does not work, but the "lock mouse in game window" function does work.

Update:
Well, the image did show up. However, it only showed up when I selected a sub menu, like opening an inventory or something. It did not show on the main menu, which is strange. The image was always there, because when I clicked that area, the OnClick function is triggered. It was just not visible, like something blocked it or was on top of it, or different layers, etc... I can only guess...

_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sun Mar 19, 2017 5:52 am    Post subject: Reply with quote

You must activate D3D Hook as soon as the game is started, if you enter a match or mission, D3D Hook will no longer work.
_________________
...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25252
Location: The netherlands

PostPosted: Sun Mar 19, 2017 6:46 am    Post subject: Reply with quote

that shouldn't matter.

but it's possible it uses some weird rendering technique.

_________________
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
View user's profile Send private message MSN Messenger
Dr.Disrespect
Grandmaster Cheater
Reputation: 3

Joined: 17 Feb 2016
Posts: 526

PostPosted: Mon Mar 20, 2017 1:06 pm    Post subject: Reply with quote

@Dark Byte
@Filipe_Br

Thank you all. I think what DB said is probably the right answer.

_________________
**************

A simple example is better then ten links. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites