locking a value at an address

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

locking a value at an address

Postby liqmysaq » Tue Apr 15, 2008 3:24 am

what is the LSS script i would use to lock a value at an address? im working on a trainer but i need to lock some values, not just poke them.
ive searched the helpfile and in the code editor but found nothing on locking. closest thing is the info on script locks, but everything i try with that fails and since its not in the function list in code editor i doubt it's usable in LSS anyway.
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby mezzo » Tue Apr 15, 2008 4:47 am

Use the thread example from the helpfile to make a thread that sets the value of an extern every X amount of time.
Be sure to add a way for the thread to be stopped too, or it will run forever.
(till you close MHS)
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 739
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby liqmysaq » Tue Apr 15, 2008 11:44 am

oh, ok. ill mess with it and see what happens. i have no clue what im doing and ill probably be asking for more detail when i get annoyed after hours of failure hehe. guess i should learn what a thread is first lol. its all still jibberish to me :P thx.
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby mezzo » Tue Apr 15, 2008 3:10 pm

threads allow multiple functions to be run at the same time (concurrently).
Just try the example L.Spiro made for threads in the helpfile, you'll see what I mean.
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 739
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby CoMPMStR » Sat Apr 26, 2008 11:06 pm

If the threading tutorial is too much for you to soak in, here's an example:

Code: Select all
BOOL bFreeze;

void On_HK_0( DWORD dw1, DWORD dw2 )
{
   bFreeze = !bFreeze;
   
   if (bFreeze == true)
   {
      HANDLE hNewThread = CreateThread("NewThread", 0);
      if (!hNewThread) { bFreeze = false; return; }
      CloseHandle(hNewThread);
   }
}

VOID NewThread(DWORD dwParam)
{
   while (bFreeze == true)
   {
      // put your code here to write the value.
      Sleep(1);
   }
}


In this snippet, When you press the hotkey it will toggle freezing. If bFreeze is FALSE then it will set it to TRUE, create the new thread, and execute the code in NewThread until bFreeze is FALSE again (which will happen if you press the hotkey again). Very simple, once you get the hang of it. The Sleep function is there so the constant looping doesn't lag or freeze MHS (or the game).
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


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron