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 


XBOX Controller Keys List for LUA Script/ Hotkeys Need.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Meiyoh
Advanced Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 97

PostPosted: Sat Mar 18, 2017 5:08 pm    Post subject: XBOX Controller Keys List for LUA Script/ Hotkeys Need. Reply with quote

Does sombody know where I can find the list of XBOX Controller keys for LUA script

like

VK+PAD A etc ... something like that so I can use Controller for lua hotkeys.

_________________
For DS3 Arena Mod - Coming Soon... Once DLC is out.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 4

Joined: 24 Feb 2017
Posts: 37
Location: Right Here Buddy.

PostPosted: Sat Mar 18, 2017 5:25 pm    Post subject: This post has 1 review(s) Reply with quote

Cheat Engine 6.6 'main.lua' starting at line 406:
Code:
getXBox360ControllerState(ControllerID OPTIONAL) : table - Fetches the state of the connected xbox controller. Returns a table containing the following fields on success:
    ControllerID : The id of the controller (between 0 and 3)
    PacketNumber : The packet id of the state you see. (use to detect changes)
    GAMEPAD_DPAD_UP : D-PAD Up (boolean)
    GAMEPAD_DPAD_DOWN: D-PAD Down (boolean)
    GAMEPAD_DPAD_LEFT: D-PAD Left (boolean)
    GAMEPAD_DPAD_RIGHT: D-PAD Right (boolean)
    GAMEPAD_START: Start button (boolean)
    GAMEPAD_BACK: Back button (boolean)
    GAMEPAD_LEFT_THUMB: Left thumb stick down (boolean)
    GAMEPAD_RIGHT_THUMB: Right thumb stick down (boolean)

    GAMEPAD_LEFT_SHOULDER: Left shoulder button (boolean)
    GAMEPAD_RIGHT_SHOULDER: Right shoulder button (boolean)

    GAMEPAD_A: A button (boolean)
    GAMEPAD_B: B button (boolean)
    GAMEPAD_X: X button (boolean)
    GAMEPAD_Y: Y button (boolean)

    LeftTrigger: Left trigger (integer ranging from 0 to 255)
    RightTrigger: Right trigger (integer ranging from 0 to 255)

    ThumbLeftX: Horizontal position of the left thumbstick (-32768 to 32767)
    ThumbLeftY: Verital position of the left thumbstick (-32768 to 32767)
    ThumbRightX: Horizontal position of the right thumbstick (-32768 to 32767)
    ThumbRightY: Vertical position of the right thumbstick (-32768 to 32767) 



EDIT:
For hot keys just set up with a timer.

But that, and a function for setting vibration, is all I have seen for a game controller with CE lua.

_________________
- Code Happy, Code Freely, Be Awesome.
Back to top
View user's profile Send private message
Meiyoh
Advanced Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 97

PostPosted: Sat Mar 18, 2017 11:42 pm    Post subject: Reply with quote

TheyCallMeTim13 wrote:
Cheat Engine 6.6 'main.lua' starting at line 406:
Code:
getXBox360ControllerState(ControllerID OPTIONAL) : table - Fetches the state of the connected xbox controller. Returns a table containing the following fields on success:
    ControllerID : The id of the controller (between 0 and 3)
    PacketNumber : The packet id of the state you see. (use to detect changes)
    GAMEPAD_DPAD_UP : D-PAD Up (boolean)
    GAMEPAD_DPAD_DOWN: D-PAD Down (boolean)
    GAMEPAD_DPAD_LEFT: D-PAD Left (boolean)
    GAMEPAD_DPAD_RIGHT: D-PAD Right (boolean)
    GAMEPAD_START: Start button (boolean)
    GAMEPAD_BACK: Back button (boolean)
    GAMEPAD_LEFT_THUMB: Left thumb stick down (boolean)
    GAMEPAD_RIGHT_THUMB: Right thumb stick down (boolean)

    GAMEPAD_LEFT_SHOULDER: Left shoulder button (boolean)
    GAMEPAD_RIGHT_SHOULDER: Right shoulder button (boolean)

    GAMEPAD_A: A button (boolean)
    GAMEPAD_B: B button (boolean)
    GAMEPAD_X: X button (boolean)
    GAMEPAD_Y: Y button (boolean)

    LeftTrigger: Left trigger (integer ranging from 0 to 255)
    RightTrigger: Right trigger (integer ranging from 0 to 255)

    ThumbLeftX: Horizontal position of the left thumbstick (-32768 to 32767)
    ThumbLeftY: Verital position of the left thumbstick (-32768 to 32767)
    ThumbRightX: Horizontal position of the right thumbstick (-32768 to 32767)
    ThumbRightY: Vertical position of the right thumbstick (-32768 to 32767) 



EDIT:
For hot keys just set up with a timer.

But that, and a function for setting vibration, is all I have seen for a game controller with CE lua.


Thank you very much!

But when I try to Put say local Combo = {GAMEPAD_DPAD_RIGHT, GAMEPAD_X} AND press those keys = Nothing happens

_________________
For DS3 Arena Mod - Coming Soon... Once DLC is out.
Back to top
View user's profile Send private message
Meiyoh
Advanced Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 97

PostPosted: Wed Mar 22, 2017 6:56 am    Post subject: Reply with quote

DOESNT WORK when I setup one of those a as combo function...
_________________
For DS3 Arena Mod - Coming Soon... Once DLC is out.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 4

Joined: 24 Feb 2017
Posts: 37
Location: Right Here Buddy.

PostPosted: Wed Mar 22, 2017 9:45 am    Post subject: Reply with quote

I have never used this, so it's hard to say what to do. But from the documentation on it, it looks like you need to create a timer then in the timer's call back use 'getXBox360ControllerState' to get a table of the controller state, then check the state to see what you need to run.

Code:

local timer = nil
local timerInterval = 100 ---- Timer intervals are in milliseconds
local timerTicks = 0
local function timer_tick(t) ---- Timer tick call back
   local tbl = getXBox360ControllerState()
   if tbl.GAMEPAD_DPAD_UP then
       -- code
   elseif tbl.GAMEPAD_A and tbl.GAMEPAD_B and not tbl.GAMEPAD_X then
       -- code
   end
end
timer = createTimer(getMainForm()) ---- Create timer with the main form as it's parent
timer.Interval = timerInterval ---- Set timer interval
timer.OnTimer = timer_tick ---- Set timer tick call back


To deal with button holds, you need to add a second timer to time the holds.

But there are no global variables for the controller state that I have seen.

_________________
- Code Happy, Code Freely, Be Awesome.
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 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