Difference between revisions of "Lua:AddScheduleRepeating"

From Fortress Forever Wiki
Jump to navigationJump to search
(New page: {{Infobox manual/Header}} ==AddScheduleRepeating== Waits a period of time, then fires a lua function. Repeats indefinitely. ===Usage=== <pre>AddScheduleRepeating(schedule_id, duration, f...)
 
 
Line 8: Line 8:
  
 
===Input===
 
===Input===
<ul>
+
* schedule_id(string) Gives the schedule a name
<li>schedule_id(string) Gives the schedule a name</li>
+
* duration(float) number of seconds the schedule will wait before firing
<li>duration(float) number of seconds the schedule will wait before firing</li>
+
* function(function) the lua function that will be activated
<li>function(function) the lua function that will be activated</li>
+
* ...(object) OPTIONAL. Any further parameters will be passed on to the target function
<li>...(object) OPTIONAL. Any further parameters will be passed on to the target function</li>
 
</ul>
 
  
 
===Output===
 
===Output===
Line 29: Line 27:
 
end</pre>
 
end</pre>
  
[[Category:Lua_Commands]]
+
[[Category:Schedules]]
 
{{Infobox manual/Footer}}
 
{{Infobox manual/Footer}}

Latest revision as of 11:26, 11 May 2009


AddScheduleRepeating

Waits a period of time, then fires a lua function. Repeats indefinitely.

Usage

AddScheduleRepeating(schedule_id, duration, function, ...)

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
  • ...(object) OPTIONAL. Any further parameters will be passed on to the target function

Output

Returns nothing.

Example

AddScheduleRepeating must refer to a user-defined lua function.

AddScheduleRepeating( "my_schedule", 3.3, DoSomething, "hello")

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