[request] LSS script/tut to poke value in a complex address

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Postby L. Spiro » Sat Sep 26, 2009 11:21 am

By removing the 0-sized array.


Code: Select all
extern struct playerYAddy {
//   BYTE bBuffer[0x0];
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];
               FLOAT fValue;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };



L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby toffey » Sat Sep 26, 2009 2:45 pm

Thank you guys very, very much it completely solved that problem.

One last question is how can I get this to work with multiple complex addresses?

I am trying to get it to work for just two complex addresses currently, but I believe I will be using more than that in the future of my current script.

Trying to use the same code twice returns an error staing that "poBase" is already declared. If I change it to something such as "poBaseX" then it says that "playerXCoord" is an undeclared identifier (Line: 45).

I've tried declaring playerXCoord (and playerYCoord) before the functions, but it then causes the script to have absolutely no effect in-game.

Sorry for all of the questions.

My Code with the first as "poBaseX":
Code: Select all
float saved_X_Loc = 0;
float saved_Y_Loc = 0;
float saved_X_Loc2 = 0;
float saved_Y_Loc2 = 0;

extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];
               FLOAT playerXCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseX = { "", 0x149E928 };


void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBaseX->poObj->poObj->poObj->playerXCoord = 0;
}

extern struct playerYAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };


void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->playerYCoord = 0;
}

VOID On_HK_CLIENT_EXE_1( DWORD dw1, DWORD dw2 ) {      //Save Location1
   saved_X_Loc = playerXCoord;
   saved_Y_Loc = playerYCoord;
   
   Sleep(10);
}


Edit: Fixed a typo in the code
Last edited by toffey on Sat Sep 26, 2009 4:12 pm, edited 1 time in total.
User avatar
toffey
Hack-Master Hex
 
Posts: 689
Joined: Fri Sep 05, 2008 5:39 pm
Location: California, USA

Postby CoMPMStR » Sat Sep 26, 2009 3:11 pm

First of all, I think you only need one void On_Open_CLIENT_EXE declaration:

Code: Select all
void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBaseX->poObj->poObj->poObj->playerXCoord = 0;
  poBase->poObj->poObj->poObj->playerYCoord = 0;
}


Secondly, the reason it tells you that poBase is already declared is because it is. poBase is declared as a pointer to the playerXAddy extern struct so it can't be declared as something else (same with poBaseX or any other global variable). poObj is a pointer declared in a seperate struct each time which is why you can use it like that without any problems. You would have to set one to poBaseX and the other to poBaseY.

Lastly, you have to call the same code to set the saved_X_Loc as you do to set it initially.

Code: Select all
saved_X_Loc = poBaseX->poObj->poObj->poObj->playerXCoord;
Image

______________________________________________________
My Utilities:
CT <-> LSSAVE Converter
LSS Visual Dialog Designer
.NET Trainer Helper Library

~Whether you think you can or you think you can't, you're right.

L. Spiro wrote:In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.
User avatar
CoMPMStR
(P)ot (I)n (M)y (P)ipe
 
Posts: 451
Joined: Thu Mar 06, 2008 7:50 am
Location: Best Place

Postby toffey » Sat Sep 26, 2009 4:05 pm

Thanks for the help again, everything is working perfectly now. I could have sworn that I tried that, but apparently not.

I had forgotten to switch "poBaseX->poObj...." back with the player coords after CTRL-Z'ing for a while to get rid of some changes. Definitely clarified it though so I appreciate that.
User avatar
toffey
Hack-Master Hex
 
Posts: 689
Joined: Fri Sep 05, 2008 5:39 pm
Location: California, USA

Postby L. Spiro » Sat Sep 26, 2009 5:05 pm

Do not waste your time making a new structure for every member that is already on the same structure.

Code: Select all
extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];
               FLOAT playerXCoord;
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };




Code: Select all
void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->playerXCoord = 0;
  poBase->poObj->poObj->poObj->playerYCoord = 0;
}



L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby toffey » Sat Sep 26, 2009 5:47 pm

I'm slightly confused. Where would I put the "BYTE bBuffer[0x1C];" in the structure for the X Coordinate (Y Coordinate uses "BYTE bBuffer[0x24])?

Code: Select all
extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];
               FLOAT playerXCoord;
               BYTE bBuffer[0x24];
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseX = { "", 0x149E928 };

The code above then causes "saved_X_Loc" to give an error saying that it is an undeclared identifier even though it is already defined. Commenting that line makes the error occur with the next variable, and so on.


This is the code I have made from CoMPMStR's suggestions:
Code: Select all
float saved_X_Loc;
float saved_Y_Loc;
float saved_X_Loc2;
float saved_Y_Loc2;

extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];     // <----- [0x1C] for the X Coordinate
               FLOAT playerXCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseX = { "", 0x149E928 };

extern struct playerYAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];     // <----- [0x24] for the X Coordinate
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseY = { "", 0x149E928 };


VOID On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBaseY->poObj->poObj->poObj->playerYCoord = 0;
  poBaseX->poObj->poObj->poObj->playerXCoord = 0;
}

VOID On_HK_CLIENT_EXE_1( DWORD dw1, DWORD dw2 ) {      //Save Location1
   saved_X_Loc = poBaseX->poObj->poObj->poObj->playerXCoord;
   saved_Y_Loc = poBaseY->poObj->poObj->poObj->playerYCoord;   
   Sleep(10);
}
User avatar
toffey
Hack-Master Hex
 
Posts: 689
Joined: Fri Sep 05, 2008 5:39 pm
Location: California, USA

Postby CoMPMStR » Sat Sep 26, 2009 6:15 pm

I don't think it would be 0x1C then 0x24 in the same struct.

Code: Select all
extern struct playerAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer0[0x1C];
               FLOAT playerXCoord; //1C+0
               BYTE bBuffer1[4]; //1C+4=0x20
               FLOAT playerYCoord; //1C+8=0x24
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };


Since 0x24 is 8 bytes away from 0x1C you should only need 4 buffer bytes in between for it to work. Also you can't declare bBuffer twice in the same struct.
Image

______________________________________________________
My Utilities:
CT <-> LSSAVE Converter
LSS Visual Dialog Designer
.NET Trainer Helper Library

~Whether you think you can or you think you can't, you're right.

L. Spiro wrote:In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.
User avatar
CoMPMStR
(P)ot (I)n (M)y (P)ipe
 
Posts: 451
Joined: Thu Mar 06, 2008 7:50 am
Location: Best Place

Postby toffey » Sat Sep 26, 2009 7:42 pm

Ah, now I get it. Thanks again guys :D
User avatar
toffey
Hack-Master Hex
 
Posts: 689
Joined: Fri Sep 05, 2008 5:39 pm
Location: California, USA

Previous

Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron