This comes from another post about text adventure games, something I haven't written for almost 25 years & I've hit a snag converting my 16 bit library to 32 bit. My question - Is it possible to write a callback function using the timer in such a way that it can emulate interrupts i.e. execute a piece of code every N (approx) seconds no matter what the main program is doing. This is completely unknown territory for me & any advice would be would be very useful.
Have a look at the last parameter of SetTimer.
thanks jj will do
Hmm, pointer to a function when timer value elapses, this looks interesting & could be what I'm looking for. Thanks jj :U I'll do some testing with it & see what happens.
I can assure you it works - my callback is 263 lines long and covers 20 different events :bg
have to have the dwarves pop out, eh ?
oh - and let's not forget the pirate, too :P
you could probably just use time of day and check it round-robin style for that
the time being precise isn't that critical
Yep! I used it (Timer_Tick) to control other characters & events, worked quite well I seem to remember although there wern't any Pirates or Dwarves in my world more like Gypsys & other vagrants :toothy
Quote... although there wern't any Pirates or Dwarves in my world more like Gypsys & other vagrants
lol - sounds great
you could even have bogdan pop out as one of the gypsies and steal your code :lol
i need to devise a game where he is the bad guy
maybe i'll make it a shoot-em-up
You would need a mighty big gun for that, maybe like the one in 'QUAKE' - BFG :cheekygreen:
Dave,
> i need to devise a game where he is the bad guy
I did not make Bogdan that Vlad Tepes icon for nothing, if you started that game he would come out with a nuclear disintegrator and melt your screen. :bdg
i was thinking of a Forum Maze game
he moves and locks threads, while you shoot at him
if he locks or moves 10 threads before you get 10 caps in his ass, you lose :bdg
Quote from: dedndave on May 17, 2010, 02:28:29 AM
i was thinking of a Forum Maze game
he moves and locks threads, while you shoot at him
if he locks or moves 10 threads before you get 10 caps in his ass, you lose :bdg
And losing means you have to attend his course "basic concepts of assembler". If you lose twice, you will have to digitally sign an obligation to ban ML.EXE from your harddisk :green2
:bg
Its all in the style, Bogdan is far more gracious than I am, he will lock the thread and tell them why, if I catch anyone posting virus/trojan/hacking etc ... I assist them in finding another venue that is better suited to their interest. :bdg
i am a pretty good shot
plus, being the guy that writes the game, i'd probably have a back-door to unlimited ammo or something - lol
the guys he works with would enjoy it more than anyone
I've re-opened this thread as I have hit a minor snag, as jj says the function works perfectly, but, I need it to repeat every 15 to 20 seconds (accuracy not important). The method I've come up with is to re-invoke the SetTimer function just before my own function exits. My question, is this the way to do it or is there a better way?
The timer will trigger periodically until you specifically kill it, there's no need for you to do anything extra (i.e. it repeats by default, it's not a one-shot.)
Thanks Tedd, I thought it was a One Shot