Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: Fr0z3N on March 18, 2006, 02:10 PM

Title: Timer in a DLL
Post by: Fr0z3N on March 18, 2006, 02:10 PM
I've tried googling it and used msdn but I can't seem to get any to work.
Title: Re: Timer in a DLL
Post by: MyndFyre on March 18, 2006, 05:11 PM
What are you doing?
Title: Re: Timer in a DLL
Post by: Fr0z3N on March 18, 2006, 05:50 PM
I've injected a dll into d2's memory, and what I want to do is run a timer that checks the users life every 100ms or w/e (making a chicken program) but I can't seem to get any working timer code.
Title: Re: Timer in a DLL
Post by: MyndFyre on March 18, 2006, 06:45 PM
Quote from: Fr0z3N on March 18, 2006, 05:50 PM
I've injected a dll into d2's memory, and what I want to do is run a timer that checks the users life every 100ms or w/e (making a chicken program) but I can't seem to get any working timer code.
What is your code like?
Title: Re: Timer in a DLL
Post by: Fr0z3N on March 18, 2006, 08:18 PM

void CheckLife() {
mylife = GetCurrentLife();
maxlife = GetMaxLife();
//sprintf(buffer, "Current Life: %d Max Life: %d", mylife, maxlife);
//PrintMessage(buffer,8);
// if (maxlife/Life > mylife) {
// PrintMessage("CHICKEN!",2)
// }
}


All I wanna do is be constantly calling that in a timer.
Title: Re: Timer in a DLL
Post by: UserLoser on March 19, 2006, 01:05 AM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers.asp
Title: Re: Timer in a DLL
Post by: Fr0z3N on March 19, 2006, 06:58 AM
Quote from: UserLoser on March 19, 2006, 01:05 AM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers.asp

Yet another timer function I could not get to work. Is there one where you can simply post the code instead of refering me to a website?
Title: Re: Timer in a DLL
Post by: Kp on March 19, 2006, 09:44 AM
Well, I suppose he could post the contents of the website instead of posting a link to it. :)

Really though, I don't see how we're supposed to help you since you still haven't shown us your timer code, so we have no way of knowing what you're doing wrong.
Title: Re: Timer in a DLL
Post by: UserLoser on March 19, 2006, 01:50 PM
Quote from: Fr0z3N on March 19, 2006, 06:58 AM
Quote from: UserLoser on March 19, 2006, 01:05 AM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers.asp

Yet another timer function I could not get to work. Is there one where you can simply post the code instead of refering me to a website?

So you want it spoonfed?  I find it hard to believe you wrote a library that injects it's self into another games process if you can't figure out two simple function calls and a callback function.
Title: Re: Timer in a DLL
Post by: Fr0z3N on March 19, 2006, 03:39 PM
Quote from: UserLoser on March 19, 2006, 01:50 PM
So you want it spoonfed?

Yes.

I have no Timer code Kp, that's the problem.
Title: Re: Timer in a DLL
Post by: MyndFyre on March 19, 2006, 03:51 PM
Quote from: Fr0z3N on March 19, 2006, 03:39 PM
I have no Timer code Kp, that's the problem.
So what you're saying is that you actually *haven't* tried anything?  These things that haven't worked just haven't been tried?
Title: Re: Timer in a DLL
Post by: Warrior on March 19, 2006, 04:27 PM
Quote from: Fr0z3N on March 19, 2006, 03:39 PM
Quote from: UserLoser on March 19, 2006, 01:50 PM
So you want it spoonfed?

Yes.

I have no Timer code Kp, that's the problem.

I (strongly) suggest you learn what you're doing before you do it. Come on you expect us to believe you were able to somehow write a routine to print to Diablo II's chat screen yet not be able to code something as simplistic as this? Even when information is basically thrown at you, you refuse to look at it -- wait you don't even show signs of trying. Cmon man.
Title: Re: Timer in a DLL
Post by: Fr0z3N on March 19, 2006, 11:20 PM
I tried it all, couldn't figure it out. I'm using a thread now so problem solved.
Title: Re: Timer in a DLL
Post by: FrOzeN on March 20, 2006, 12:57 AM
Did you even follow the links? After two clicks it shows that MSDN spoonfeeds it for you anyway.  :-\
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/usingtimers.asp
Title: Re: Timer in a DLL
Post by: Explicit on March 20, 2006, 01:52 AM
Fr0z3N and FrOzeN, wow.
Title: Re: Timer in a DLL
Post by: warz on March 20, 2006, 11:43 AM
Quote from: Explicit[nK] on March 20, 2006, 01:52 AM
Fr0z3N and FrOzeN, wow.

Fr0z3N is the original.
Title: Re: Timer in a DLL
Post by: Joe[x86] on March 21, 2006, 07:40 PM
We also have krazed and craz3d.
Title: Re: Timer in a DLL
Post by: SecretShop on March 29, 2006, 06:01 PM
Disclaimer: Im not familar with D2 in any way.

With that said, I know this much, D2 is a game with graphics.  Those graphics are rendered, to render them there is a loop that draws each frame.  It may be easier for you just to place a call to your function that checks the current life of the character in the primary rendering loop of the game.