Does anyone know how to UNhook at timer?
Displaying 1-9 of 9 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
blues_zodiakos

In my menu library I'm making for V3, I'm trying to create a function that renders a window on top of the screen, but renders independently of the action going on behind it - sort of like the chrono trigger windows, if you know what I mean. You can still walk around and such. I'm also creating a queue system so that up to 10 of these windows can be rendered at the same time (or define any number you want).

Now, I figure I need to hook this function to a timer, depending on whether a variable is set (ZMLRenderWindows=1). I'm not sure how fast HookTimer is though, and some people would like to run multiple hooktimers for their own use, so I'd like to be able to unhook the timer when ZMLRenderWindows=0. Is this possible? Am I even going about this the right way?

I was thinking something along these lines...


Main loop
{
DoAllOtherStuff();
Switch(ZMLRenderWindows)
Case 0: UnhookTimer(ZML_RenderWindow);
Case 1: HookTimer(ZML_RenderWindow);
}
RenderEverything();
}



Is this possible?

I don't think UnhookTimer is a recognized symbol. :(

Edit by author: On second thought, I probably need to use HookRetrace instead :(

[edit by mcgrue: added the pre tag]

Posted on 2004-02-16 19:34:30 (last edited on 2004-02-16 19:49:17)

mcgrue

I might be wrong, but hooktimer is something you want to do on a trigger-basis, not continuously in a loop...

Posted on 2004-02-16 20:28:26

Gayo

Wouldn't you want to hook it to the render, rather than to the timer?

Posted on 2004-02-16 20:48:09

Overkill

If you're going to loop it like that, you don't even need a hookretrace() or hooktimer().

I think you can use the Control/Render loop method (Zaratustra used it a lot). Posts won't let me use the greater than or less than symbols, so replace it with the actual symbol. It should end up something like this:


CODE:

int timer2;
void MainLoop()
{
int done;
timer2=systemtime;
while(!done)
{
while(timer2 LESS THAN systemtime)
{
DoAllOtherStuff();
//Insert both the functions for processing walking &
//animation variables. JUST DON'T PUT DRAWING
// FUNCTIONS HERE.
timer2+=2;
}
//All things rendered go here
if (ZMLRenderWindows) ZML_RenderWindow();
RenderEverything();
Showpage();
}
}



Try that and see if that works.

Posted on 2004-02-17 02:13:44

zeromus

try hooktimer("") with an empty string.

but I agree with the other guys; you should consider a different approach. i do see a valid use for engine hooks, for you, where you want to make it entirely invisible to the user of your windowing lib, but that aint the way to go about it

Posted on 2004-02-17 03:41:16

vecna

Yeah. And just to clarify, Hook* functions work as follows:


void mytimerfunc()
{
stuff;
}

void autoexec()
{
HookTimer("mytimerfunc"); // To hook.
// now I want to unhook! what do I do!
HookTimer("");
// oh that will work!
}


Edit: Damn you, zeromus!!

Posted on 2004-02-17 03:43:30 (last edited on 2004-02-17 03:45:03)

blues_zodiakos

Thanks to everyone who has posted here. :D

My main problem was that I hadn't actually tried coding it yet before I posted that. I started coding today and all the wonderful (heh) memories of VC came back to me. :D

As someone stated, the main reason I wanted to use a hooktimer was that I can imagine some poor person is going to cry when they download my lib and find out they have to create (not just cut and paste, but create) about 20 new lines of confusing code to be able to get it to work. Now for my game, I will almost definitely just do it manually, but I'd rather a person who got the lib just have to paste 3 or so lines of code from the readme and it be transparent. Even so, I'm still not sure if that is going to work. It may be time for people to actually learn VC. :D

Another problem, though, is that I think I had the damnedest time trying to get that to work in a demo I made back when. Something about not being able to control entities the way I wanted them to or something, I don't remember. It'll probably jog my mind if I try to do it again. :/

I actually got a fair amount of work done today with the start of the lib, much of the main foundation. I even have a little mini demo to test it. :D Now that someone reminded me how to use arrays again (a must have for my menu select function), it should be a whole lot more interesting by tomorrow, when I might release a demo. :D

Although it works in a non-map environment, I have absolutely no idea what it will do when you have hooktimer effects going off in the background and such. Maybe I should add some Layer stuff to the lib like V1 had. I liked the V1 layer system.

Posted on 2004-02-17 06:10:12 (last edited on 2004-02-17 06:11:04)

Toen

Also to do less-than or greater-than symbols, until grue sets up the parser to perhaps allow them, you can use html's lt and gt characters.
<Toen> WHOA LOOKEY!

Posted on 2004-02-17 18:24:34

mcgrue

However, don't use preview if you use &lt;... It'll just turn into a < in the preview box, and you're back to square one.

I need to fix that. I need to fix so, so much... ;_;

Posted on 2004-02-17 20:21:31


Displaying 1-9 of 9 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.