View previous topic :: View next topic |
Author |
Message |
Cissamannen Cheater Reputation: 0
Joined: 16 Jul 2009 Posts: 36
|
Posted: Fri Sep 03, 2021 4:13 am Post subject: |
|
|
This is via an emulator (retroarch) in Final Fantasy 9.
I tried doing several battles with it enabled, but nothing changed at all :/
In the table itself I can see in battle going to 1. But the gained AP is stuck at default given amount for said enemy.
_______
What I just noticed, is if I enable the "script enabler" one while in battle, it automatically sets it to "true". But its stuck there even after a battle has ended. Even if the value is not 1. So it seems the timer isnt running while enabled to continously check? Because as long as I had enabler ticked when in battle, that wont update until i re-enable it outside battle again, and setting 999 wont work again.
Perhaps it would work to add the timer into the enabler itself and run it from there?
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Sep 03, 2021 5:07 am Post subject: |
|
|
Hmm, it should already be there. In your Lua Cheat Table Script window set it like this:
#1 - Cheat Table Lua Script
Code: |
inBattle = false
-- This is the address that holds the flag value
addressToCheck = 0x1000E11B8
oldValue = readBytes(addressToCheck,2)
function isInBattle()
if readBytes(addressToCheck,1) == 1 then
inBattle = true
else
inBattle = false
end
end
tmrInBattle = createTimer(MainForm, false)
tmrInBattle.Interval = 10
tmrInBattle.OnTimer= isInBattle
function enableCheck()
tmrInBattle.Enabled = true
end
function disableCheck()
if tmrInBattle.Enabled then
tmrInBattle.Enabled = false
end
end
end
|
#2 - Enable Check Script
It should look similar to this:
Code: |
[ENABLE]
{$LUA}
--Start the timer
enableCheck()
{$ASM}
[DISABLE]
{$LUA}
--Stop the timer
disableCheck()
|
#3 - Other Scripts
Now, in the other scripts you can write the values to the addresses as you see fit
Code: |
[ENABLE]
{$LUA}
-- Change this to the address you want to change
local addressToChange = 0x99999999
local oldValue = readBytes(addressToChange, 2)
-- Write the new value to the address specified at the top of this script
writeSmallInteger(addressToChange, new_value_here)
{$ASM}
[DISABLE]
{$LUA}
-- Write the old value to the address specified at the top of this script
writeSmallInteger(addressToChange, oldValue)
|
Hopefully, that resolves the problem.
|
|
Back to top |
|
|
Cissamannen Cheater Reputation: 0
Joined: 16 Jul 2009 Posts: 36
|
Posted: Fri Sep 03, 2021 10:20 am Post subject: |
|
|
Ok I tested these new ones. So now, whenever I enable the write 999 value, it does it once no matter if its in battle or not, then it stops doing it in full. Like it sets the value when its enabled, but then just forgets it exists, kinda? Kinda like the loop of checking is not enabled?
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Sep 03, 2021 10:27 am Post subject: |
|
|
Sorry for the mass-testing but I think a further check is required:
Code: |
[ENABLE]
{$LUA}
-- Change this to the address you want to change
local addressToChange = 0x99999999
local oldValue = readBytes(addressToChange, 2)
-- Write the new value to the address specified at the top of this script
if inBattle then
writeSmallInteger(addressToChange, new_value_here)
else
writeSmallInteger(addressToChange, oldValue)
{$ASM}
[DISABLE]
{$LUA}
-- Write the old value to the address specified at the top of this script
writeSmallInteger(addressToChange, oldValue)
|
Last edited by LeFiXER on Fri Sep 03, 2021 11:07 am; edited 1 time in total |
|
Back to top |
|
|
Cissamannen Cheater Reputation: 0
Joined: 16 Jul 2009 Posts: 36
|
Posted: Fri Sep 03, 2021 10:31 am Post subject: |
|
|
Hmm.
That one gives access code violation because not all code is injectable. (setting 'end' after writing old value seems to fix that though. But its the same issue as before. Writes once even if in or out of battle. Like it doesnt really bother with the inBattle being true or false.
I dont mind the testing. Educational experience this all!
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Sep 03, 2021 11:09 am Post subject: |
|
|
That should have resolved the issue (sorry about the missing end) I often type this stuff outside of an editor and these things can slip the mind.
You're sure the timer is enabled? If you can, add to Discord, I've sent a PM with my S/N.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Fri Sep 03, 2021 12:17 pm Post subject: |
|
|
Cissamannen wrote: | my main issue is, some codes will break the game if always enabled, hence I need a way to get the conditional way to work, and I guess lua be the way to go.
So for example:
if 1000E11B8 = 1 (Byte)
then 1000EDF38 = 999(int)/03E7 (frozen or not doesnt matter i believe)
if 1000E11B8 is not 1
then 1000EDF38 = what game changes it to be
1000E11B8 = 1 is basically the flag for being in battle | That sounds like something you should be doing in the gameshark code. Or, alternatively, decipher what the gameshark code is doing and implement it in Lua. Just don't try to mix the two because it gets more complicated than it needs to be. From what I read I think you're trying to do the latter.
I'm not going to look at this thread in depth, but here's some things I noticed at a quick glance:
- readByte isn't a function. Use readBytes(address,1)
- The AOBScan Lua function has optional alignmenttype / alignmentparam parameters you can use (i.e. alignmenttype = fsmLastDigits; alignmentparam = '7EB6'); see celua.txt
- "oldValue = readBytes(0x1000EDF38,2)" only stores the first byte read. Maybe you want readSmallInteger instead?
- retroarch isn't an emulator- it's a frontend
- Indent your code properly. If I see consecutive end statements on the same indentation level I usually leave
- "if condition then return true else return false end" is a meme
The more of this thread I read the more annoyed I get... people offering help don't always have to know what they're doing, but they should at least test the code they write.
If you can read/write gameshark code, I really think you'd be better off using gameshark code to do this. It's generally easier to hack something when you're closer to the thing you're trying to hack- i.e. not going through an emulator to do it.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Sep 03, 2021 1:50 pm Post subject: |
|
|
ParkourPenguin wrote: |
readByte isn't a function. Use readBytes(address,1)
|
This was a typographical error, sorry. I did mean readBytes; however, the level of help I offer is just to help the person achieve the goal they have set out to do rather than teach. I am self-taught and with that I can say that I'm not a professional, the stuff I know is what I've read. I do appreciate that you take the time to point out errors because that way I, and others, can improve.
Quote: |
"if condition then return true else return false end" is a meme[/list]The more of this thread I read the more annoyed I get... people offering help don't always have to know what they're doing, but they should at least test the code they write.
|
I'm not sure where you saw the if condition return true else false but in the code I provided it has an actual condition based on a value held at an address.
Code: |
inInBattle = false
function isInBattle()
if readBytes(addressToCheck,2) == 1 then
inBattle = true
else
inBattle = false
end
end
|
Which was meant to set the flag for use in another script. If I have done this in a bad way I can only apologise and ask is there a better way to achieve that?
Quote: |
If you can read/write gameshark code, I really think you'd be better off using gameshark code to do this. It's generally easier to hack something when you're closer to the thing you're trying to hack- i.e. not going through an emulator to do it.
|
I wholly agree with this statement, emulators often include a cheating system that works well for the games they emulate.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Fri Sep 03, 2021 3:20 pm Post subject: |
|
|
Several people, including OP, made the mistake of using readByte. It's important to read code and check it for mistakes before copy/pasting it.
Using if...else to assign a boolean value to a variable using an expression that results in a boolean as the condition is an almost pointless indirection. The only argument I can see is that it might be more readable to some people, but I don't think it even achieves that.
That code reminded me of this recent reddit post on r/ProgrammerHumor:
https://www.reddit.com/r/ProgrammerHumor/comments/pdt1hr/and_you_will_deserve_it/
Code: | function isInBattle()
inBattle = readBytes(addressToCheck,1) == 1
end |
The part about me being annoyed wasn't tied solely to that- it was my perception that people don't have as much pride in what they do as they should. There are obvious mistakes in this thread that could have been avoided if the poster took less than a minute of their time to see if the code would even run. You should check if the help you're providing is right before you try to help others, especially if you're not experienced in something. Providing wrong answers is arguably worse than not responding in the first place.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Cissamannen Cheater Reputation: 0
Joined: 16 Jul 2009 Posts: 36
|
Posted: Fri Sep 03, 2021 3:39 pm Post subject: |
|
|
Yes. It is basically more my curiosity of how cheat engine could do the same tricks as gameshark could. It's all still a learning experience. As it could offer a bit more on the fly editing than resetting over and over to change values by using the built in functions.
The aobscan has been resolved and expanded on with the help of Birdi, so big thanks there!
Will play about with it some more over the weekend sometime!
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Sep 03, 2021 8:19 pm Post subject: |
|
|
ParkourPenguin wrote: | Several people, including OP, made the mistake of using readByte. It's important to read code and check it for mistakes before copy/pasting it.
Using if...else to assign a boolean value to a variable using an expression that results in a boolean as the condition is an almost pointless indirection. The only argument I can see is that it might be more readable to some people, but I don't think it even achieves that.
That code reminded me of this recent reddit post on r/ProgrammerHumor:
https://www.reddit.com/r/ProgrammerHumor/comments/pdt1hr/and_you_will_deserve_it/
Code: | function isInBattle()
inBattle = readBytes(addressToCheck,1) == 1
end |
The part about me being annoyed wasn't tied solely to that- it was my perception that people don't have as much pride in what they do as they should. There are obvious mistakes in this thread that could have been avoided if the poster took less than a minute of their time to see if the code would even run. You should check if the help you're providing is right before you try to help others, especially if you're not experienced in something. Providing wrong answers is arguably worse than not responding in the first place. |
I just could not test it as I neither have retroarch nor the game in question. I prefer to test manually before posting code but since that wasn't an option for me the OP had to do the testing for me. I like to think I take pride in what I do and do things the right way which is why I ask if there is a better way to do things should anyone notice a mistake in what I have posted. If I may ask, how would you have approached this issue?
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Fri Sep 03, 2021 9:53 pm Post subject: |
|
|
You don't need to exactly mimic the other person's environment to test code. I use the CE tutorial as a sandbox of sorts all the time. globalalloc memory if I want to do something myself, or use step 2 and the "hit me" button if it's more convenient.
That last code I wrote is a good example. I took about 20 seconds to run this code and verify that syntax works despite already being certain it would work:
Code: | local a = 0 == 0
print(tostring(a)) -- prints 'true'
local b = 0 == 1
print(tostring(b)) -- prints 'false' |
You could write some tests yourself and avoid several mistakes:
- "readByte" isn't a function
- "readBytes(0x1000EDF38,2)" doesn't return a single 2-byte integer but 2 separate bytes
- Your first definition of the "isInBattle" function isn't syntactically valid Lua code
1 and 2 you could've also learned from reading the documentation in celua.txt.
3 is a mistake that really irks me. It's a syntax error: simply trying to click "Execute script" would've told you it's wrong (I tested this too).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Fri Sep 03, 2021 10:06 pm Post subject: |
|
|
Thank you for taking the time to reply and offer your advice/process. I have much reading to do it appears. I wasn't aware that conditional logic was acceptable after initialisation of variables but you are entirely right.
The readByte was a typographical error, a slip of the finger missed the S key and lack of time did not allow me to proofread my reply; nevertheless, I thank you for your insight and advice. I will take that on-board and hope that I can improve further.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sat Sep 04, 2021 1:59 am Post subject: |
|
|
Quote: |
"readByte" isn't a function
|
it is in 7.3 (readByte(address) returns one single byte)
_________________
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 |
|
|
Birdi Expert Cheater Reputation: 0
Joined: 08 Jun 2020 Posts: 122 Location: Migrating
|
Posted: Sat Sep 04, 2021 3:11 am Post subject: |
|
|
I tried to help externally a couple days ago, but after a few hours went to bed and just got back to see if any progress was made.. I'm definitely not an expert but I try, anyway. My attempts were successful but catching an edge case completely broke it for seemingly no reason.. when I'm home I can post the excerpts and maybe get some insight there. I knew about the extra parameters of AOBscan but tried a different method of getting last digits and that was what likely broke it all. I planned on amending my function to include it but time is always a factor.
Tba
_________________
Trying to learn!
Add me on Discord if you want hands-on help: Birdi#0007 |
|
Back to top |
|
|
|