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 


run once code ... again

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Thu Mar 08, 2012 9:08 am    Post subject: run once code ... again Reply with quote

Sorry for asking again...
I'm currently working on a code that gives the player whatever weapon he/she want's.
it works like this.

more code...
mov eax,weapon_id //weapon_id is a register(ebx)
push eax
more code...

this code is being executed a lot of times by different codes, example enemies, and it makes the game to crash if runned more than once.

i want an auto assemble code that will auto deactivate after it was runned once
i mean, after giving the player the weapon (executing the code just once) ... return to original code...
how do i do that ?
thanks Very Happy

_________________
... Fresco
Back to top
View user's profile Send private message
SwaggaJackin'
Master Cheater
Reputation: 2

Joined: 06 Nov 2009
Posts: 312

PostPosted: Thu Mar 08, 2012 9:41 am    Post subject: Reply with quote

1.create a symbol in auto assembler
2.assign the symbol to the cheat table
3.have the code read the symbol (i.e. if value == 0) then run the code
4. after executing what you want, have the assemble script change the symbol to > 0

EDIT: It's probably much easier to do this with lua now, but I haven't used the lua engine in CE yet.
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Thu Mar 08, 2012 11:13 am    Post subject: Reply with quote

the problem is i don't know how to do that.
is this what you are suggesting ? :

Code:
alloc(mycode,2048)
label(symbol)
label(etc...)
...

symbol:
dd 0

mycode:

push ...
cmp symbol,1
je do_not_run
run:
//runcode
mov symbol,1
jmp exit:
do_not_run:
jmp exit:
pop ...

_________________
... Fresco
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

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

PostPosted: Thu Mar 08, 2012 3:33 pm    Post subject: Reply with quote

symbol is the address of symbol, so use [symbol] to get to the value

cmp [symbol],1

mov [symbol],1

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
SwaggaJackin'
Master Cheater
Reputation: 2

Joined: 06 Nov 2009
Posts: 312

PostPosted: Thu Mar 08, 2012 7:13 pm    Post subject: Reply with quote

Also to create a symbol in auto assembler:

Code:

registersymbol(my_symbol)


if you no longer need it
Code:

unregistersymbol(my_symbol)


After creation, you can add the symbol to your address list by putting 'my_symbol' in the "Address:" textbox.
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Fri Mar 09, 2012 8:49 am    Post subject: Reply with quote

Thank you guys,
but i was looking for a way to actually disable the code.
i know that the code above will work, my intent was to run the disable part after [symbol1] = 1
as far as i know, the code above, in the cheat table will still be enabled X.
i want it disabled in the cheat table after execution.

also if not possible, how do i add a new address line (in the cheat table) that points to the value of [symbol1], so i can press a hotkey to make that value 0 so that the code could be enabled once more and more ...

also i want to change weapon_id.
that's the code:

Code:
mov eax,weapon_id
(eax=my inventory) (weapon_id=what weapon to add)

in hex would be like
Code:
newmemstart:
address ----  hex ------------ assembly code

01A00000     B8 0D000000   mov eax,0000000D

where B8 = mov eax,
and    0D000000    weapon_id


i want to add to the cheat table an adress that will always point at newmemstart+offset
in this example weapon_id address would be:
newmemstart+1 (4 bytes)

----

now, i tried to insert in "add new address, address" the declared name in the script, but it doesn't work (tried newmemstart), maybe because the substituted original code jumps to another name (an old one i once used, but then deleted).
i'm afraid that if i use that name, other codes will use it too if enabled first.
for example if i enable health code ... health code will jmp to the "old name" i once used, but then deleted.

in other words.
i first made a script "alloc(mem1,2048)" then deleted that scrip,
then made another scrip "alloc(labelno2,2040)" ... but at the original location the code does not "jmp labelno2" but does "jmp mem1" ... i hope i made myself clear.

i want the address to always point that specific code, not to health code or others.

_________________
... Fresco
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Sat Mar 10, 2012 10:49 am    Post subject: Reply with quote

can someone help ?
_________________
... Fresco
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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