View previous topic :: View next topic |
Author |
Message |
Gou Cheater Reputation: 0
Joined: 02 Oct 2017 Posts: 39
|
Posted: Wed Nov 01, 2017 3:34 pm Post subject: Increase the value of an address by 1 |
|
|
Hello guys!
I need some help with a script.
So, when enabled i want it to change the value of an address from 0 to 1,
and then increase the value of an other address by 1. When disabled, i want it to do the opposite.
I am sure that information about this already exists, but i can't seem to find it.
What would be the code for this?
I do not want to set a value. I just want to increase it by 1.
If it matters, they are both bytes.
Thanks in advance!
That's where i am right now. The only thing missing is the increase value code that i asked for
Code: |
[ENABLE]
20799800:
db 1
[DISABLE]
20799800:
db 0
|
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Nov 01, 2017 4:54 pm Post subject: |
|
|
Code: | [ENABLE]
20799800:
db 1
{$lua}
writeBytes(0x2079990,readBytes(0x2079990,1,false)+1)
{$asm}
[DISABLE]
20799800:
db 0
{$lua}
writeBytes(0x2079990,readBytes(0x2079990,1,false)-1)
{$asm} |
|
|
Back to top |
|
|
Gou Cheater Reputation: 0
Joined: 02 Oct 2017 Posts: 39
|
Posted: Wed Nov 01, 2017 5:05 pm Post subject: |
|
|
Hello Zanzer!
Thanks for the reply.
Using your code i ended up with this script
Code: | [ENABLE]
20799800:
db 1
{$lua}
writeFloat(20642EE0,readFloat(20642EE0,1,false)+1)
{$asm}
[DISABLE]
20799800:
db 0
{$lua}
writeFloat(20642EE0,readFloat(20642EE0,1,false)-1)
{$asm} |
But i get this message(attached pic) when i click execute, and i cannot activate the script.
Also, looking at the addresses again, i just now noticed that i made a mistake. Only the first one is a byte. The second one(that i want to increase) is a float. Thats why the code that pasted says writeFloat
I am sorry.
Thanks for the reply once again!
Description: |
|
Filesize: |
5.61 KB |
Viewed: |
8028 Time(s) |
|
Last edited by Gou on Wed Nov 01, 2017 8:27 pm; edited 2 times in total |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Nov 01, 2017 7:14 pm Post subject: |
|
|
In Lua, hex values are preceded by "0x", as in my examples.
Code: | writeFloat(0x20642EE0,readFloat(0x20642EE0)+1 |
|
|
Back to top |
|
|
Gou Cheater Reputation: 0
Joined: 02 Oct 2017 Posts: 39
|
Posted: Wed Nov 01, 2017 7:29 pm Post subject: |
|
|
I did try it, since i originally copy pasted your code. But i got the same error.
I removed it at some point just to check. Of course it didn't work.
Just to be sure that i am not that stupid, i retyped 0x on all of the addresses, and i am still getting the same error.
Edit: Ok, so i removed the ",1,false" part from your original code, and it now works like a charm. What is it's purpose? Is it wrong to have it missing?
I know that my english skills are kinda terrible and you are probably wondering what i mean. Let me show you
Code that did not work:
Code: | writeFloat(0x20642EE0,readFloat(0x20642EE0,1,false)+1) |
Code that works:
Code: | writeFloat(0x20642EE0,readFloat(0x20642EE0)+1) |
Thanks for your help anyway! I am grateful!
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4290
|
Posted: Wed Nov 01, 2017 8:05 pm Post subject: |
|
|
The function readBytes has three parameters: an address, the number of bytes to read, and whether or not those bytes should be returned as a table.
readFloat has only one parameter: an address. The second and third parameters of readBytes don't make sense for readFloat because a float is always 4 bytes long and the function is only suppose to read one float.
Why did you say both values were bytes if one of them was a float?
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Gou Cheater Reputation: 0
Joined: 02 Oct 2017 Posts: 39
|
Posted: Wed Nov 01, 2017 8:25 pm Post subject: |
|
|
Oh i see! It's a very similar command, and such difference wasn't listed in the cewiki. So assumed that it's the same syntax. But yeah, it makes sense that this isn't the case because its float.
I am sorry, but i am new
Yes i did make a mistake. I didn't double check before posting, and i remembered that they were both bytes.
I am sorry once again
Zanzer's original code should have worked(not with positive results because the byte/float thing), but it didn't. Just in case you are wondering why, it was because i did not open the process before saving the script on the cheat table.
So to summarize, 100% of my issues were caused by my ignorance.
I need to follow a LUA tutorial for sure. I recently started learning C++, VB, PHP and SQL at college and it's already pretty tough for a newcomer like me. I am afraid that starting to learn LUA on top of those is gonna melt my brain
Thanks once again!
|
|
Back to top |
|
|
Prehistoricman Advanced Cheater Reputation: 0
Joined: 02 Aug 2016 Posts: 80
|
Posted: Thu Nov 02, 2017 7:07 am Post subject: |
|
|
Don't trust the wiki. It's best to use the celua.txt documentation in the cheat engine folder.
_________________
Er, hi |
|
Back to top |
|
|
Gou Cheater Reputation: 0
Joined: 02 Oct 2017 Posts: 39
|
Posted: Thu Nov 02, 2017 2:55 pm Post subject: |
|
|
Wow i had no idea!
There is so much stuff in here!
Thanks man!
|
|
Back to top |
|
|
|