View previous topic :: View next topic |
Author |
Message |
cheat_me Newbie cheater Reputation: 0
Joined: 18 Aug 2012 Posts: 10
|
Posted: Fri Aug 24, 2012 1:04 pm Post subject: Execute the same code on every key press |
|
|
There is a possibility to add assembler script to a cheat table. This assembler script contains two sections, disable and enable. If I assign a hotkey to this script, I can execute the first code then the second, then the first again. What if I want to do the same action on every key press, for example add 50 hp every time I press the button. I can put the same code in both sections, but this would look odd. There must be a better solution.
|
|
Back to top |
|
|
oLaudix Expert Cheater Reputation: 3
Joined: 25 Mar 2010 Posts: 138
|
Posted: Fri Aug 24, 2012 3:21 pm Post subject: |
|
|
Put in in LUA script.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Fri Aug 24, 2012 3:25 pm Post subject: |
|
|
Setting values with an auto assembler script is already odd
Just add the address (using a registered symbol if needed) and set a hotkey that sets the value to the specific value
_________________
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 |
|
|
cheat_me Newbie cheater Reputation: 0
Joined: 18 Aug 2012 Posts: 10
|
Posted: Fri Aug 31, 2012 9:54 am Post subject: |
|
|
Dark Byte wrote: | Setting values with an auto assembler script is already odd
Just add the address (using a registered symbol if needed) and set a hotkey that sets the value to the specific value |
It's not an address. It's a complex script with a lot of adressess.
Why must it anyway be auto assembler only for code injection and LUA scripts for "one shot" actions. For example I need to inject a "jmp" code, but the code itself is quite complex. I wouldn't figure it out solely in assembler. So I write C code, then compile it with GCC into assembler source, then copy that assembler code into CE. Also there is an odd behavior, why CE integers are in hex format by default, while in MASM they are decimal? But nevertheless, after a little editing, GCC asm is suitable for CE.
On the other hand. If CE supported code injection in LUA format, I wouldn't have to mess with assembler. I think Dark Byte must think about it.
|
|
Back to top |
|
|
happyreadygo Advanced Cheater Reputation: 1
Joined: 14 Sep 2011 Posts: 87
|
Posted: Fri Aug 31, 2012 3:54 pm Post subject: |
|
|
just remove disable part of your script... then
u make a function in lua , put an autoassembly in the function.
and assign both hotkey event with the same function.
..but i don't understand , why u need both disable part and enable part in your old aa script to be the same?
|
|
Back to top |
|
|
cheat_me Newbie cheater Reputation: 0
Joined: 18 Aug 2012 Posts: 10
|
Posted: Fri Aug 31, 2012 9:15 pm Post subject: |
|
|
I wish there was a tutorial on how to work with LUA cheat tables. Is there?
|
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Sat Sep 01, 2012 12:47 am Post subject: |
|
|
So you need a hotkey to reapply a ton of jumps to your main code...Is it because the code you patch is within a .dll that is reloaded from disk each time you -for example- load a level?
|
|
Back to top |
|
|
cheat_me Newbie cheater Reputation: 0
Joined: 18 Aug 2012 Posts: 10
|
Posted: Sat Sep 01, 2012 6:25 am Post subject: |
|
|
Gniarf wrote: | So you need a hotkey to reapply a ton of jumps to your main code...Is it because the code you patch is within a .dll that is reloaded from disk each time you -for example- load a level? |
I need a code that reveals the map. The map is an array of cells, each cell is described with a structure. One particular field of a cell structure contains a boolean value, defining if the cell is visible or not. I need a script, which is a loop. It loops over about 10000 structures, and changes the value of that field for each.
And there is no way back. Since I don't keep track of which cells were visible before cheat was applied, I can't revert it back (only close the hole map). So this is a one shot operation without a "disable" section.
Now tell, how to embed lua script in a cheat table. A small step by step example would be nice. And how to mix assembler with lua.
|
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Sat Sep 01, 2012 7:08 am Post subject: |
|
|
I assume you use the alloc function (and maybe createthread ?) in the enable part of your map revealer. For such script the disable part would simply be deallocating the memory you used.
Aside that, to embed a lua script in lua go to Table->Show Cheat Table Lua Script ctrl+alt+L and put your code there. Your lua code will probably look like:
Code: | function MapRevealer()
local script=[[
your_[enable]_script_here (without the [enable] line)
]]
autoAssemble(script);
end
createHotkey (MapRevealer,VK_F2)
|
Then hit "execute script". It will NOT run MapRevealer() but will register it and create the hotkey.
|
|
Back to top |
|
|
cheat_me Newbie cheater Reputation: 0
Joined: 18 Aug 2012 Posts: 10
|
Posted: Mon Sep 03, 2012 1:45 pm Post subject: |
|
|
Then what is the benefit of using those LUA extra lines of code, if I could just use pure asm scripts? The people above are saying that using asm for such operations is odd. I would like to see how to do this in not an odd way.
|
|
Back to top |
|
|
Csimbi I post too much Reputation: 94
Joined: 14 Jul 2007 Posts: 3110
|
Posted: Mon Sep 03, 2012 3:28 pm Post subject: |
|
|
The whole thing you're asking for is odd in its own (setting a value via a script in ENABLE/DISABLE sections of an AA script) - not just the means.
Without LUA or AA:
Right-click the address (in the table) you want to change and set one or more hotkeys for it (and define what each hotkey does). It's that simple.
|
|
Back to top |
|
|
Gniarf Grandmaster Cheater Supreme Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Mon Sep 03, 2012 9:52 pm Post subject: |
|
|
cheat_me wrote: | Then what is the benefit of using those LUA extra lines of code, if I could just use pure asm scripts? | The benefit is that you don't need to put the same asm code in the enable and disable section, since there is no disable section. Instead it applies a your asm script each time you press a given hotkey, which is afaik what you asked for in the OP.
cheat_me wrote: | The people above are saying that using asm for such operations is odd. I would like to see how to do this in not an odd way. | Usually when we want to set a value like bIsCellRevealed we add its address in the cheat table, like Csimbi said. But since you have 10000 of those, I'm a bit worried about CE freezing for a while when loading your cheat table, so imo, setting those values with a looping script is a good idea.
Thinking again about it, if we ditch the concept of applying an asm script on keypress, you can also make a lua script that loops and writes all the bIsCellRevealed (example below). If you try it, could you tell me if you experience notable freezes/slowdowns? I have no idea how much time it takes the lua interpreter to do 10k loops+WriteProcessMemorys.
Code: | function MapRevealer()
local base_address = --acquire the address of the first bIsCellRevealed here
local end_address=base_address+10000*STRUCTURE_SIZE
for address=base_address,end_address,STRUCTURE_SIZE do
writeBytes(address, 01) --assuming 01 means "cell visible"
end
end
createHotkey (MapRevealer,VK_F2) | Replace STRUCTURE_SIZE with the proper constant.
This script assumes that all your cell structures are allocated contiguously.
Now the big question is: "Injected asm code or lua script from CE"? Well that depends on performance. If lua is fast enough, go for it. Plus that will spare you the GCC blues.
|
|
Back to top |
|
|
|