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 OnClick

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
hydris
Newbie cheater
Reputation: 0

Joined: 09 Jan 2013
Posts: 19

PostPosted: Fri Jul 24, 2015 3:58 am    Post subject: D3D OnClick Reply with quote

I've been using http://forum.cheatengine.org/viewtopic.php?t=552281
as a reference to get started, so far the only thing stopping me from making a menu is OnClick() being a nil value (besides that OnKeyDown isn't compatible with DINPUT8 so it's out of the picture- I still hope I can get key inputs somehow with isKeyPressed() in for the in-game menu but maybe that belongs in another thread).

The Lua functions seems to have changed since the time of that tutorial.
I got
Code:

function onOpenProcess()
    reinitializeSymbolhandler() --wait until process is fully attached
    autoenable_favorites() --this is for something else
    hook = createD3DHook()
end


If I try to do
Code:

hook.OnClick(option_click)

I get
Quote:
attempt to call field 'OnClick' (a nil value)
Script Error


Can post the entire set of functions if needed. I got the functions in the cheat table, and I'm testing stuff by calling functions in Lua Engine.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jul 24, 2015 5:58 am    Post subject: Reply with quote

The d3dhook doesn't have an onClick property
the d3dobjects like sprites do

_________________
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
hydris
Newbie cheater
Reputation: 0

Joined: 09 Jan 2013
Posts: 19

PostPosted: Fri Jul 24, 2015 6:06 am    Post subject: Reply with quote

Thank you, that clears some stuff up.
Append:
I saw
Code:
D3DHOOK class:
The d3dhook functions provide a method to render graphics and text inside the game, as long as it is running in directx9, 10 or 11

createD3DHook(textureandcommandlistsize OPTIONAL, hookmessages OPTIONAL)
  Hooks direct3d and allocates a buffer with given size for storage of for the rendercommand list

  hookmessages defines if you want to hook the windows message handler for the direct3d window. The d3dhook_onClick function makes use of that


  If no size is provided 16MB is used and hookmessages is true

  Note: You can call this only once for a process

  It returns a d3dhook object

properties
  Width: Integer : The width of the screen (readonly)
  Height: integer: The height of the screen (readonly)
  DisabledZBuffer: boolean : Set this to true if you don't want previously rendered walls to overlap a newly rendered object (e.g map is rendered first, then the players are rendered)
  WireframeMode: boolean : Set this to true if you don't want the faces of 3d objects to be filled
  MouseClip: boolean : Set this if to true if you have one of those games where your mouse can go outside of the gamewindow and you don't want that.
  OnClick: function(d3dhook_sprite, x, y)
    A function to be called when clicked on an sprite (excluding the mouse)
    x and y are coordinates in the sprite object. If sprites overlap the highest zorder sprite will be given. It does NOT care if a transparent part is clicked or not

    Note: If you set this it can cause a slowdown in the game if there are a lot of sprites and you press the left button a lot

  OnKeyDown: function(virtualkey, char)
    function(vkey, char) : boolean
      A function to be called when a key is pressed in the game window (Not compatible with DirectInput8)
      Return false if you do not wish this key event to pass down to the game

So I thought it did.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jul 24, 2015 1:21 pm    Post subject: Reply with quote

Oh yes, it does. (I wrote the previous message when on mobile and didn't really remember)

Anyhow, you assign the hook function, not call it
so:
hook.OnClick=option_click

and then in option_click figure out which object is clicked

_________________
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
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