Jump to content

extract threadName from script when fileName given


gokuta

Recommended Posts

Filename given as "cleoscript.cs", is there a way to determine its threadName, given by opcode

03A4: script_name 'CLEOSCR'

possibly by reading memory? C++ solution also okay, but I would surely prefer CLEO script doing it. Any ideas?

Edited by gokuta
Link to comment
Share on other sites

not extract, just check if it's running and only if it is a valid name, means: name must have max. 7 charackter

0AAA: 10@ = thread 'PMCEXQA' pointer
wait 250
if
not 10@ == 0
jf @

i can't remember why i put wait 250, but i believe that had a reason

Edited by ZAZ
Link to comment
Share on other sites

3 hours ago, gokuta said:

Filename given as "cleoscript.cs", is there a way to determine its threadName

I don't think there is a direct connection between a file name and the script name in game memory. You might be able to find the link by poking around in Cleo memory - I've go no clue of how to pull that off though.

However, you could open the file and scan for opcode 0x03A4 (A4 03). Or load the beginning of the script into memory and search with memory opcodes. For your single quote example the following type byte is 0x09, then just read the null terminated string. If double quotes are used the type byte is 0x0E followed by a string length.

It is possible that the thread could be named using global or local variables - don't remember trying this though. I have several scripts that are assigned conditional names by a subroutine, but usually the naming opcode is either the first command or only proceeded by a NOP statement. If you are working with your scripts, you could easily control for consistent formatting and thread name offset.

 

Link to comment
Share on other sites

13 hours ago, OrionSR said:

I don't think there is a direct connection between a file name and the script name in game memory. You might be able to find the link by poking around in Cleo memory - I've go no clue of how to pull that off though.

However, you could open the file and scan for opcode 0x03A4 (A4 03). Or load the beginning of the script into memory and search with memory opcodes. For your single quote example the following type byte is 0x09, then just read the null terminated string. If double quotes are used the type byte is 0x0E followed by a string length.

It is possible that the thread could be named using global or local variables - don't remember trying this though. I have several scripts that are assigned conditional names by a subroutine, but usually the naming opcode is either the first command or only proceeded by a NOP statement. If you are working with your scripts, you could easily control for consistent formatting and thread name offset.

 

The path of scanning the script might be the way to go. However I have no idea how to do it xD any clues? What opcodes I may find useful for this task

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.