Difference between revisions of "Lua:AddScheduleRepeatingNotInfinitely"

From Fortress Forever Wiki
Jump to navigationJump to search
(New page: {{Infobox manual/Header}} ==AddScheduleNotInfinitely== Waits a period of time, then fires a lua function. Repeats x number of times, then self-destructs. ===Usage=== <pre>AddScheduleRepe...)
 
 
Line 30: Line 30:
 
end</pre>
 
end</pre>
  
[[Category:Lua_Commands]]
+
[[Category:Schedules]]
 
{{Infobox manual/Footer}}
 
{{Infobox manual/Footer}}

Latest revision as of 11:27, 11 May 2009


AddScheduleNotInfinitely

Waits a period of time, then fires a lua function. Repeats x number of times, then self-destructs.

Usage

AddScheduleRepeatingNotInfinitely(schedule_id, duration, function, limit, ...)

Input

  • schedule_id(string) Gives the schedule a name
  • duration(float) number of seconds the schedule will wait before firing
  • function(function) the lua function that will be activated
  • limit(integer) maximum number of times the schedule will fire
  • ...(object) OPTIONAL. Any further parameters will be passed on to the target function

Output

Returns nothing.

Example

AddScheduleRepeatingNotInfinitely must refer to a user-defined lua function.

AddScheduleRepeatingNotInfinitely( "my_schedule", 3.3, DoSomething, 5, "hello")

--This function can be defined anywhere in the file--wherever is convenient.
function DoSomething (myString)
	--myString now equals "hello"
	--Do other stuff
end