View previous topic :: View next topic |
Author |
Message |
microsoftv Advanced Cheater Reputation: 0
Joined: 07 Apr 2016 Posts: 82 Location: U.S
|
Posted: Sun May 01, 2016 2:26 pm Post subject: Condition Triggerbot |
|
|
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 |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Sun May 01, 2016 2:49 pm Post subject: |
|
|
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 |
|
|
microsoftv Advanced Cheater Reputation: 0
Joined: 07 Apr 2016 Posts: 82 Location: U.S
|
Posted: Sun May 01, 2016 10:14 pm Post subject: |
|
|
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 |
|
|
PinPoint Expert Cheater Reputation: 10
Joined: 07 Apr 2016 Posts: 223 Location: Scotland
|
Posted: Mon May 02, 2016 2:24 am Post subject: |
|
|
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 |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Mon May 02, 2016 7:34 am Post subject: |
|
|
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 |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon May 02, 2016 7:36 am Post subject: |
|
|
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 |
|
|
microsoftv Advanced Cheater Reputation: 0
Joined: 07 Apr 2016 Posts: 82 Location: U.S
|
Posted: Mon May 02, 2016 8:35 pm Post subject: |
|
|
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 |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Mon May 02, 2016 8:48 pm Post subject: |
|
|
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 |
|
|
microsoftv Advanced Cheater Reputation: 0
Joined: 07 Apr 2016 Posts: 82 Location: U.S
|
Posted: Tue May 03, 2016 6:12 pm Post subject: |
|
|
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 |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue May 03, 2016 6:25 pm Post subject: |
|
|
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 |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Tue May 03, 2016 6:40 pm Post subject: |
|
|
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 |
|
|
|