Frictional Games Forum (read-only)

Full Version: My one scripting weakness
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I don't understand how to set a delay or something or a timed function. How would I create a repeating function that, on every repeat of the function, it adds 1 to a local variable, for example? could somebody just type that out so I could look at it?
void OnStart()
{
AddTimer("Repeat", 5, "RepeatTimer") //This creates a timer that calls after 5 seconds
}

void RepeatTimer(string &in asTimer) //The timer
{
if(asTimer == "Repeat")
{
AddLocalVarInt("Repeat", 1); //This adds 1 to the LocalVarInt "Repeat".
AddTimer("Repeat", 5, "RepeatTimer") //This creates a timer that calls after 5 seconds

}

if(GetLocalVarInt("Repeat") == 5) //If the timer has repeated 5 times...
{
Function(); //The stuff you want to do
}
}
I suppose you are talking about timers. When a time passes, something happens, really?
If it's that way, maybe this is useful for you:


http://wiki.frictionalgames.com/hpl2/tut...iferorange
And at the final scare. She uses timers.
Scare 4 - Kill The Lights

Edit: Ninja'd by beecake another time XD
(10-16-2012, 06:27 PM)The chaser Wrote: [ -> ]I suppose you are talking about timers. When a time passes, something happens, really?
If it's that way, maybe this is useful for you:


http://wiki.frictionalgames.com/hpl2/tut...iferorange
And at the final scare. She uses timers.
Scare 4 - Kill The Lights

Edit: Ninja'd by beecake another time XD
Sorreeeeeh!...
Off-topic: Doesn't matter. But, ninja me another time, beecake, and I will send you waspsauce.

Worst joke ever XD (not agressive intentions wanted to be shown)

On-Topic: Did you succed, Bennick?