Page 1 of 1

Question with calculating an address in a private base in SC

PostPosted: Thu Feb 02, 2017 3:16 pm
by PercyPierce
Hi guys! Sorry if this question has been asked before but I just figured out how to get the script editor to work, and I came up with this code.

Code: Select all
VOID Lock ( MHS_ADDRESS aAddress, INT iItemSize )
{
extern INT p2buttons = { "", aAddress };  // This is the address of the joystick that's plugged into the computer that the emulator picks up. A PRIVATE address that moves when I reboot the emulator.
extern BYTE P2facing = { "", ssf.exe + 6473071 }; // This is a variable that tells me if the player is facing right or left (0 or 1).


// I put no code here yet

}

I get a compile error when I press ok. My question is how do I get the script to calculate addresses across modules? It doesn't seem as simple as it is when using the expression evaluator.

Re: Question with calculating an address in a private base in SC

PostPosted: Thu Feb 02, 2017 4:15 pm
by L. Spiro
Code: Select all
extern BYTE P2facing = { "", ssf.exe + 6473071 };

should be:
Code: Select all
extern BYTE P2facing = { "ssf.exe", + 6473071 };



L. Spiro

Re: Question with calculating an address in a private base in SC

PostPosted: Fri Jul 28, 2017 2:28 am
by PercyPierce
Hey there guys I have another question. I am making an AI for a fighting game. Because I am just disappointed by the AI that the game itself has. Now there are about 32 characters in the game, and I would like to make a separate file for each one. Then I would like memhack to stream the code for each character off of the disk.



Code: Select all
VOID Lock ( MHS_ADDRESS aAddress, INT iItemSize )
{

extern BYTE yourcharacter = {"ssf.exe", 0x6472EA8};


   
   


switch (yourcharacter)

{
   case 0: {   /*open notepad txt file containing code for this character and load it into here.   */   break;}      
   case 1: {   /*open notepad txt file containing code for this character and load it into here.      */   break;}      
        case 2: {   /*open notepad txt file containing code for this character and load it into here.      */   break;}      
        case 3: {   /*open notepad txt file containing code for this character and load it into here.      */   break;}      
                           
}
}
}







is memhack capable of doing this?

Re: Question with calculating an address in a private base in SC

PostPosted: Fri Aug 04, 2017 2:42 pm
by L. Spiro
I see no problem with it. It’s up to you to find the files and parse them, etc., but otherwise this should be a very simple task.
Just use the FILE functions to access the files and breakpoints to trigger scripts.


L. Spiro

Re: Question with calculating an address in a private base in SC

PostPosted: Sun Dec 10, 2017 9:03 am
by PercyPierce
ok here's an example:
Code: Select all
Select all
    VOID Lock ( MHS_ADDRESS aAddress, INT iItemSize )
    {

    extern BYTE yourcharacter = {"ssf.exe", 0x6472EA8};


       
       


    switch (yourcharacter)

    {
   
            case 4: {   FOpen( "C:UsersBuyerGoogle DriveStreet Fighter Zero 3 Saturn AIchunli.lss","r");   break;}     
                               
    }
    }
    }






Does nothing. Do I really have to use breakpoints to trigger scripts, or is there a way to just like open the file and replace the FOPEN function with the contents of the file?

Sorry I haven't replied to your post in a while.

Re: Question with calculating an address in a private base in SC

PostPosted: Mon Dec 18, 2017 5:23 am
by L. Spiro
Scripts can be triggered by opening a process, starting up MHS, via hotkeys, etc. All of these methods are in the help file.

You opened the file but you did not store the FILE * that FOpen() returns. You can’t use FRead() or FWrite() without that pointer.
There are many tutorials online on how to work with files in C.
http://www.thegeekstuff.com/2012/07/c-file-handling/


L. Spiro