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 


CE doesn't know what [stuff] means

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Thu Jan 21, 2021 6:35 am    Post subject: CE doesn't know what [stuff] means Reply with quote

Hi, im trying to incorporate 2 scripts into one, but im finding issues and don't know how to solve.
I come here for guideance.

Code:
[ENABLE]
registersymbol(VehicleMainPtr)
globalalloc(VehicleMainPtr,8)
alloc(VehicleMainPtr,8)
VehicleMainPtr:
{$lua}
return ("dq %08X"):format(syntaxcheck and 0 or getAddress'[["c2ss.exe"+27DEFD0]+0]+8C4')
{$asm}
{$lua}
--if syntaxcheck then return end
local addr = getAddress"[VehicleMainPtr]-644" --Health
writeFloat(addr, 3000)
createTimer(500, function() memrec.Active = false; end)
{$asm}
[DISABLE]


CE doesn't know what [VehicleMainPtr] means, if i run the script that returns this symbol, it works.
So i would like to know if it's possible to set this up in a way that, the script registers the symbol, allocates, and starts to use the symbol right away setting values and stuff, instead of returning, and ignoring the rest.
Essentially im looking for the equivalent of this:

Code:
[VehicleMainPtr]=getAddress'[["c2ss.exe"+27DEFD0]+0]+8C4')


Thanks in advance.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Thu Jan 21, 2021 7:24 am    Post subject: Reply with quote

($lua} scripts run before the AA script gets executed as their result becomes part of the AA script. (e.g could be an alloc as well) so it can not see where getAddress"[VehicleMainPtr]-644 is going to be

the first lua block seems to so what you want

_________________
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
View user's profile Send private message MSN Messenger
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Thu Jan 21, 2021 8:55 am    Post subject: Reply with quote

Hi, thanks for the answer.

If i understood you correctly, placing that first lua block on top of everything should setup things for the rest to work.

I did that, but still it complains, this time it says that in the second lua block there was an attempt to compare a number with nil, on top of that, the asm bit is not setting the values.

What am i missing?
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Fri Jan 22, 2021 7:22 pm    Post subject: Reply with quote

Still no solution for this as of yet. Only way it runs is if the first lua block runs separately first.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Fri Jan 22, 2021 7:56 pm    Post subject: Reply with quote

Get rid of alloc(...) - globalalloc also allocates memory

This is still a problem I don't think you understand:
Dark Byte wrote:
($lua} scripts run before the AA script gets executed... so it can not see where getAddress"[VehicleMainPtr]-644 is going to be

The Lua blocks run before the symbol VehicleMainPtr gets registered by globalalloc. The memory for VehicleMainPtr hasn't even been allocated yet when the Lua blocks run. When you try to execute the Lua expression getAddress"[VehicleMainPtr]-644", it doesn't work because VehicleMainPtr doesn't exist yet.

This whole rube goldberg machine of AA / Lua scripts you have seems like it would be much better implemented as a hotkey on a memory record with base address "c2ss.exe"+27DEFD0 and offsets 0, 280 (bottom up).

_________________
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
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sat Jan 23, 2021 3:28 am    Post subject: Reply with quote

Ah, i've made the click, Thanks.

I guess there's no equivalent in lua to:

registersymbol(VehicleMainPtr)
globalalloc(VehicleMainPtr,8)

is there?

Tried to insert it with:

Code:
autoAssemble([[registersymbol(VehicleMainPtr)
globalalloc(VehicleMainPtr,8)]])

But it failed.

If there was, i could, in theory incorporate it, and since it would run previously to other lua blocks, it would solve the issue, correct?

ps: Im doing all i can to avoid hotkeys, but the sugestion is noted.
Code:
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Jan 23, 2021 7:44 am    Post subject: Reply with quote

Code:

autoAssemble([[globalalloc(VehicleMainPtr,8)]])

_________________
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
View user's profile Send private message MSN Messenger
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sat Jan 23, 2021 8:59 am    Post subject: Reply with quote

I think i tried everything a newbie like me could.

Code:
[ENABLE]
//autoAssemble([[registersymbol(VehTweaksPtr)]])
//return ("dq %08X"):format(syntaxcheck and 0 or getAddress'[[[[["c2ss.exe"+01F9AED8]+18]+278]+8]+120]+C')
{$lua}
return ("dq %08X"):format(syntaxcheck and 0 or getAddress'[[[[["c2ss.exe"+01F9AED8]+18]+278]+8]+120]+C')
--if syntaxcheck then return end
autoAssemble([[globalalloc(VehicleMainPtr,4)]])
--autoAssemble([[registersymbol(VehTweaksPtr)]])
local VehTweaksPtr = getAddress'[[[[["c2ss.exe"+01F9AED8]+18]+278]+8]+120]+C'
local addr = getAddress"[VehTweaksPtr]+E4" --Dmg
writeFloat(addr, 0)
--createTimer(500, function() memrec.Active = false; end)
[DISABLE]



It still complains that it doesn't know that [VehTweaksPtr]+E4 is, despite in theory that symbol being registered and stuff.
This code was the last ditch effort to try to assign VehTweaksPtr to the address in that pointer there.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Mon Jan 25, 2021 12:08 pm    Post subject: Reply with quote

I thought that
Code:
autoAssemble([[globalalloc(VehicleMainPtr,8)]])

was the missing link, but despite the symbol being registered, (i can see it show up in the userdefined symbols window), the script still fails because VehicleMainPtr is nil.
So it seems like the solution should be simple: assigning the pointer address to VehicleMainPtr, what do i need to do to accomplish that?

Best regards
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Mon Jan 25, 2021 12:20 pm    Post subject: Reply with quote

There's not much anyone on these forums can do if you're incapable of reading and understanding your own code. Go look up a Lua tutorial online so you can learn Lua- e.g. what the "return" keyword does.

I still think you're needlessly overcomplicating this and you'd be better off using a memory record + hotkey.

_________________
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
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Tue Jan 26, 2021 2:36 am    Post subject: Reply with quote

You're correct in that I don't know enough to solve this.
Let's say I do the memory record, create a header with the pointer, what happens if I have 3 pointers but only one is valid at any point in time? This is why I was going with lua, because the next step was going to be retrieving the valid one for use. Also I need to multiply some values and divide others.

EDIT: In the screenshot the output for VehicleMainPtr address is correct, but the addresses i got in the table which use the symbol are not updating.

EDIT2: using this code

Code:
autoAssemble([[globalalloc(VehicleMainPtr,8)]])
if syntaxcheck then return end
local addr = ("%08X"):format(syntaxcheck and 0 or getAddress'[["c2ss.exe"+27DEFD0]+0]+8C4')
--local addr = getAddress'[["c2ss.exe"+27DEFD0]+0]+8C4'
print(addr)
unregisterSymbol("VehicleMainPtr")
registerSymbol("VehicleMainPtr",addr,true)


i can get VehicleMainPtr to become the right "address", but still not a symbol that can be used as pointer.

Best regards[/code]



Screenshot 2021-01-26 102527.png
 Description:
 Filesize:  7.87 KB
 Viewed:  2726 Time(s)

Screenshot 2021-01-26 102527.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Tue Jan 26, 2021 11:37 am    Post subject: Reply with quote

Sounds like you have 3 bad pointers and you should be using code injection to get the address instead (search "injection copy").

"globalalloc" allocates memory and registers the symbol. You're undoing that with unregistersymbol (effectively leaking the globalalloc) and re-registering the symbol at some other address. Use writePointer instead, don't execute anything if syntaxcheck is true (you're not returning anything to check), and don't format the address into a string before passing it to writePointer:
Code:
if syntaxcheck then return end
autoAssemble'globalalloc(VehicleMainPtr,8)'
local addr = getAddress'[["c2ss.exe"+27DEFD0]+0]+8C4')
print(("%08X"):format(addr))
writePointer("VehicleMainPtr", addr)

_________________
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
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Tue Jan 26, 2021 12:09 pm    Post subject: writePointer! Reply with quote

Hi, thanks for the reply! We did it! It seems like what i was after was the writePointer instruction, searched for it after seing your post, but it seems like it's not a common instruction, could not even find a page in wiki about it.

An explanation about the pointers: When i get into a car, a certain opcode will give me an address for the car's acceleration, for example, but if i get into a bike, it will be another opcode, in another kind of vehicle, yet another opcode/instruction.
So what i did was get a pointer from each type of vehicle, this way i don't need to inject everytime i change vehicles, the pointer will assume the correct value, now, of course, if i only "look" at one pointer, it will be wrong for certain vehicles, but another one will be correct/valid.
The pointer for the cars is always correct for cars.
The unregistering and then registering again the symbol, was something i saw in a table i found, was a trial and error kind of thing, all the while feeling that it didn't make much sense.

Thank you very much, both, for your kind help to a noob like me.

Left a little something in paypal to help keep the development of CE.
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