Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Scripting Multiple Timers Using the Stock Engine's Global FPI Variables (v1.09 & up)

Author
Message
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Dec 2008 03:28 Edited at: 14th Dec 2008 03:34
Ok,
I know you guys have heard me say that you can do multiple timers with the stock engine.
However, until now I had never taken the time to actually script a working model of it in action.
So, here it is.

This video illustrates the use of multiple timers using the stock engine.

The example uses two timers both running on one second increments. (script tested supports five timers)

The example uses three buttons... (via scancodekeypressed=x)

j = resets timer 1

l = resets timer 2

k = resets both timers

Of course, your use of the timers would go beyond the basic reset illustrated here, but the point is to show control of the timer.

Here is what the video shows...
I start off by resetting timer one.
Then, I reset timer two.
Then, I reset both timers.

You can clearly see both timers working independently of each other.

This example utilizes 4 scripts.

Main Timer
This runs the one global timer in FPSC on a one second loop.
Each time we loop we increment each timer variable by one. (separate timers can be incrmented at different values if you want)

Timer 1 Display
The name says it all; this displays timer one.

Timer 2 Display
This creates and displays the huds for timer two.

Timer Control
For the example I used one script to illustrate the controls.
However, in your applications you would probably be using more than one script to do this.
More than likely your timers will be reset and evaluated in separate entity scripts of the entities related to the timer.

Anyway, I have tested it, and the system does work.

Don't forget to visit Conjured Entertainment

Attachments

Login to view attachments
meteorite
18
Years of Service
User Offline
Joined: 19th Nov 2006
Location: The Capital Wasteland
Posted: 14th Dec 2008 03:32
I figured this out fir nightvision purposes, but it's good for the community to know this kind of stuff (although with etimer it's worthless to me)


*slap!*
Quiet yourself, think before posting, and maybe you won't be as ignorant as you seem.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 14th Dec 2008 13:15
thanks for the system CE...but im a ply's mod user.

I know not with what weapons WWIII will be fought but WWIV will be fought with sticks and stones-Albert Einstein
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Dec 2008 17:44
Quote: "although with etimer it's worthless to me"

ok
Quote: "thanks for the system CE...but im a ply's mod user"

cool

Of course, the display scripts would not really be needed.
They were only used as a visual for the video.
In game, many timers would not need any display, so scripting this is real easy.

Here is the
for the main script for the example...

Don't forget to visit Conjured Entertainment

Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 15th Dec 2008 03:42
Nice CE. Thanks for the time put into this. Although there are some who use other mods, the majority still use FPSC out of the box.



__________________________________________________________
Make life a little easier and use FPI Editpad for your sctripting needs.
We're a proud sponsor of PlyMod 1.07 which includes airmod 0.6.

The past has a lot of memories to hold onto; but, today is chock full of new adventures, and, the future shouts out, "The best is yet to come!" -- TerryC
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 15th Dec 2008 05:22 Edited at: 15th Dec 2008 05:27
Quote: "Nice CE. Thanks for the time put into this. Although there are some who use other mods, the majority still use FPSC out of the box."

Thanks Flatlander
The users of the stock engine are the ones who it was intended for as the title of the thread implies.

Here is the
I used for the timer reset functions.
Again, this is set up to rest timer 1 using the 'j' key, and timer 2 using the 'l' key, and 'k' resets them both.

Here is the
that I used for timer 1.

Here is the
that I used for timer 2.

You will notice that I use the same images for displaying the numerals as I did with the cash system.

You would have to place four dynamic entities witht their always active set to YES.
Then assign each of these scripts to one of the entities.

Have Fun!

Don't forget to visit Conjured Entertainment

Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 15th Dec 2008 09:01
Looks good, I may have use for these

Free Segment Packs: V1-http://forum.thegamecreators.com/?m=forum_view&t=124552&b=24
V2 - http://forum.thegamecreators.com/?m=forum_view&t=124709&b=24
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 15th Dec 2008 16:09
Thanks Marc

Like I said earlier, you really do not need to use a display for the timersif you don't need one.
I used a straight forward approach to the display as you can see, and I limited it to 30 seconds for the example.
You could easily make that for sixty seconds, and even increment a variable for the minutes each time the second timer trips.
This would be done in the display script as to not foul the main one, although you could put it in the main if you want.
Another variable could hold the hours if we want to take it that far, but I doubt that you want to be timing hours of gameplay.

Feel free to use/modify/distribute these scripts any way you like, as long as you leave the Conjured header in the script.

Don't forget to visit Conjured Entertainment

Login to post a reply

Server time is: 2024-11-24 16:52:20
Your offset time is: 2024-11-24 16:52:20