View previous topic :: View next topic |
Author |
Message |
Quarter187 Newbie cheater Reputation: 0
Joined: 13 Aug 2022 Posts: 13
|
Posted: Thu Aug 18, 2022 4:35 pm Post subject: readInteger & writeInteger |
|
|
I can write values to a notepad text file.
Write script:
Code: | local file = io.open("shared.txt","w")
local val = readInteger("166E7A0A3E0")
file:write(val)
file:close()
print(file) |
Read script:
Code: | local file = io.open("shared.txt", "r")
local read = file:read("*all")
file:close()
print(read) |
How would I send the value to a different address?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Fri Aug 19, 2022 1:05 am Post subject: |
|
|
writeInteger(different address)
_________________
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 |
|
|
Quarter187 Newbie cheater Reputation: 0
Joined: 13 Aug 2022 Posts: 13
|
Posted: Fri Aug 19, 2022 7:06 am Post subject: |
|
|
Dark Byte wrote: | writeInteger(different address) |
Could you possibly show me an example of applying writeInteger it to the read script? I can't seem to get it to work. I am attempting to read the value from the text file and send it to the address. With trainers you can send text so I figured somehow do the same thing but with a .txt file.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4299
|
Posted: Fri Aug 19, 2022 10:45 am Post subject: |
|
|
writeInteger needs a value too
Again, see the CE wiki, celua.txt, or search the forums for examples.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Quarter187 Newbie cheater Reputation: 0
Joined: 13 Aug 2022 Posts: 13
|
Posted: Fri Aug 19, 2022 11:06 am Post subject: |
|
|
ParkourPenguin wrote: | writeInteger needs a value too
Again, see the CE wiki, celua.txt, or search the forums for examples. |
How would I make the value the number that was read from the txt?
I have looked far and wide for what I am trying to do. I have found no example of writing values from a txt, only writing to one. I have been looking deep into I/O Library for solutions. Maybe if I get the linecount of the file and iterate through it based on the linecount then I could update the address according to the loop? I'm really asking for help on this one.
This is what I have got so far:
Code: | local open = io.open
local function read_file(path)
local file = open(path, "r")
if not file then return nil end
local content = file:read "*a"
writeInteger("179F34935A0", 100) --need to change to read value
file:close()
return content
end
print(read_file("shared.txt")) |
I just cant figure out how to make the value what was read.
|
|
Back to top |
|
|
cooleko Grandmaster Cheater Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Fri Aug 19, 2022 1:06 pm Post subject: |
|
|
You will get more help if you demonstrate that you made progress. And if you can demonstrate you made progress you would actually solve your problem.
Here, you want to perform a sequence of steps:
Read a file
Use something read from the file
Have you read the file? Did you prove to yourself that the file is getting read? What is the function returning as read?
If you can't read a file, then Google how to read a file and follow those steps until you can.
If you read the file, why can't you use what you read? What did it give you and why didn't it work.
Is there a format problem, is it a cleanup issue, or is it a type mismatch? Once you figure that out, you will be able to Google the solution.
I have been ignoring most of your posts because you are asking for trivial programming assistance that has nothing to do with cheat engine. But I wager you are reading text from the file and need to supply integers to the function. Or you never even got that far. No one knows how far you got because you arent troubleshooting your problem and describing exactly what you can't get to work. If you were you wouldn't be asking for help because you would realize what the mistake was and googled the solution.
From an outside perspective you are tossing your hands in the air and saying nothing works.
You have received a lot of advice but you are getting resistance because this style of troubleshooting is fundamental to ever getting anything working in programming.
Just take a deep breath, look at the problem one step at a time, and ensure you are getting exactly what you expect, and need, for each step. If you aren't, that is your problem. Describe it to Google and 100 other people have asked and solved those issues.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4299
|
Posted: Fri Aug 19, 2022 3:22 pm Post subject: |
|
|
Quarter187 wrote: | Code: | local content = file:read "*a"
writeInteger("179F34935A0", 100) --need to change to read value |
| Have you tried changing `100` to `content`? You don't even need to convert that string to a number. CE will automatically do that in writeInteger.
I have a really hard time understanding your situation and why you're having so much difficulty with this. Maybe you just need to take a break? I've been in situations before where I couldn't figure out why something wasn't working. I left it, came back to it after a few days, and found the problem in under a minute.
Also, you shouldn't use the asterisk in `file:read'*a'`. Lua accepts it anyway for backwards compatibility.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
|