Frictional Games Forum (read-only)
[SCRIPT] My one scripting weakness - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] My one scripting weakness (/thread-18814.html)



My one scripting weakness - Bennick - 10-16-2012

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?


RE: My one scripting weakness - FlawlessHappiness - 10-16-2012

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
}
}


RE: My one scripting weakness - The chaser - 10-16-2012

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/tutorials/scripting/scaresbyjenniferorange
And at the final scare. She uses timers.
Scare 4 - Kill The Lights

Edit: Ninja'd by beecake another time XD


RE: My one scripting weakness - FlawlessHappiness - 10-16-2012

(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/tutorials/scripting/scaresbyjenniferorange
And at the final scare. She uses timers.
Scare 4 - Kill The Lights

Edit: Ninja'd by beecake another time XD
Sorreeeeeh!...


RE: My one scripting weakness - The chaser - 10-16-2012

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?