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 


Condition Triggerbot

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

Joined: 07 Apr 2016
Posts: 82
Location: U.S

PostPosted: Sun May 01, 2016 2:26 pm    Post subject: Condition Triggerbot Reply with quote

If anyone knows how to force a keystroke (Z) when a certain Address turns to a certain Value (1), i'd love any input on it, i'm somewhat new, but I understand most of CE.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Sun May 01, 2016 2:49 pm    Post subject: Reply with quote

Code:
if readInteger(0xABCD1234) == 1 then
  doKeyPress(VK_Z)
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
microsoftv
Advanced Cheater
Reputation: 0

Joined: 07 Apr 2016
Posts: 82
Location: U.S

PostPosted: Sun May 01, 2016 10:14 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Code:
if readInteger(0xABCD1234) == 1 then
  doKeyPress(VK_Z)
end


Thanks a lot, I really appreciate you going out of your way to help me. I assume I just insert the appropriate Address into "0xABCD1234"? And also, is there a way to have it toggleable? Ex: If Keystroke (Q) is pressed, activate "line of code".
Back to top
View user's profile Send private message
PinPoint
Expert Cheater
Reputation: 10

Joined: 07 Apr 2016
Posts: 223
Location: Scotland

PostPosted: Mon May 02, 2016 2:24 am    Post subject: Reply with quote

microsoftv wrote:
ParkourPenguin wrote:
Code:
if readInteger(0xABCD1234) == 1 then
  doKeyPress(VK_Z)
end


Thanks a lot, I really appreciate you going out of your way to help me. I assume I just insert the appropriate Address into "0xABCD1234"? And also, is there a way to have it toggleable? Ex: If Keystroke (Q) is pressed, activate "line of code".


set a hotkey to the script in the addresslist.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Mon May 02, 2016 7:34 am    Post subject: Reply with quote

Yes. Also, an alternative to embedding that Lua code inside an AA script and setting the hotkey via the address list would be to make your own hotkey in Lua using createHotkey(...). Look in main.lua (inside CE's directory) for information on it.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Mon May 02, 2016 7:36 am    Post subject: Reply with quote

microsoftv wrote:
And also, is there a way to have it toggleable? Ex: If Keystroke (Q) is pressed, activate "line of code".
-Just set up a conditional jump for that. You already have it set up to send a key press if a particular value is 1, now you just have to check against that value (or the key press value) and have the target execute the alternative segment of code if the condition is true.
Back to top
View user's profile Send private message
microsoftv
Advanced Cheater
Reputation: 0

Joined: 07 Apr 2016
Posts: 82
Location: U.S

PostPosted: Mon May 02, 2016 8:35 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Yes. Also, an alternative to embedding that Lua code inside an AA script and setting the hotkey via the address list would be to make your own hotkey in Lua using createHotkey(...). Look in main.lua (inside CE's directory) for information on it.


Forgot to ask what if the address is a pointer address? And how would I add a script to the address list?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Mon May 02, 2016 8:48 pm    Post subject: Reply with quote

You can either traverse the pointer path directly via readPointer(address) or let CE do it using this shortcut:
Code:
readInteger("[[game.exe+12AB]+13F]+24")

If you want to embed it inside an AA script, use the {$lua} tag:
Code:
[ENABLE]
{$lua}
-- Lua code here
{$asm}
// other assembly code
[DISABLE]
// etc...

If you plan on using hotkeys, however, it would be easier to only use the Lua script window IMO.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
microsoftv
Advanced Cheater
Reputation: 0

Joined: 07 Apr 2016
Posts: 82
Location: U.S

PostPosted: Tue May 03, 2016 6:12 pm    Post subject: Reply with quote

ParkourPenguin wrote:
You can either traverse the pointer path directly via readPointer(address) or let CE do it using this shortcut:
Code:
readInteger("[[game.exe+12AB]+13F]+24")

If you want to embed it inside an AA script, use the {$lua} tag:
Code:
[ENABLE]
{$lua}
-- Lua code here
{$asm}
// other assembly code
[DISABLE]
// etc...

If you plan on using hotkeys, however, it would be easier to only use the Lua script window IMO.


So far I have made this:
createHotkey(VK_V)
if readPointer(0x134C45C) == 1 then
doKeyPress(VK_Z)
end
But it does nothing sadly, any suggestions?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Tue May 03, 2016 6:25 pm    Post subject: Reply with quote

Yes:
ParkourPenguin wrote:
Look in main.lua (inside CE's directory) for information on it.

In case you don't feel like opening it and reading it in a text editor:
Quote:
GenericHotkey Class : (Inheritance: Object)
createHotkey(function, keys, ...) : returns an initialized GenericHotkey class object. Maximum of 5 keys
createHotkey(function, {keys, ...}) : ^

properties
DelayBetweenActivate: integer - Interval in milliseconds that determines the minimum time between hotkey activations. If 0, the global delay is used
onHotkey: The function to call when the hotkey is pressed

methods
getKeys()
setKeys(key, ....)
setOnHotkey(table)
getOnHotkey

Some other tips: learn Lua. Google for tutorials and examples. Look at other people's scripts. If you try to program in a language you don't know, you're not going to be able to do anything.

Here's an example of how to use createHotkey:
Code:
local function exampleHotkeyFunction(sender)
  print("hotkey pressed.")
end
myHotkey = createHotkey(exampleHotkeyFunction, VK_Z)
myHotkey.DelayBetweenActivate = 400

To destroy it, call myHotkey.destroy().

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue May 03, 2016 6:40 pm    Post subject: Reply with quote

FYI, all of this can be done using strictly assembly. However, I agree with ParkourPenguin that learning LUA can be advantageous. I wish I knew it, but I have to prioritize my time learning other things at the moment.
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