Difference between revisions of "Lua:AddSchedule"

From Fortress Forever Wiki
Jump to navigationJump to search
(New page: {{Infobox manual/Header}} ==IsPlayer== A schedule waits for a period of time, then fires a lua function. ===Usage=== <pre>AddSchedule(schedule_id, duration, function, ...)</pre> ===Inpu...)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Infobox manual/Header}}
 
{{Infobox manual/Header}}
==IsPlayer==
+
==AddSchedule==
  
A schedule waits for a period of time, then fires a lua function.
+
A schedule allows you to fire a lua function, after waiting x number of seconds.
  
 
===Usage===
 
===Usage===
Line 8: Line 8:
  
 
===Input===
 
===Input===
schedule_id(string) Gives the schedule a name
+
* schedule_id(string) Gives the schedule a name
duration(float) number of seconds the schedule will wait before firing
+
* duration(float) number of seconds the schedule will wait before firing
function(function) the lua function that will be activated
+
* function(function) the lua function that will be activated
...(object) OPTIONAL. Any further parameters will be passed on to the target function
+
* ...(object) OPTIONAL. Any further parameters will be passed on to the target function
  
 
===Output===
 
===Output===
Line 27: Line 27:
 
end</pre>
 
end</pre>
  
[[Category:Lua_Commands]]
+
[[Category:Schedules]]
 
{{Infobox manual/Footer}}
 
{{Infobox manual/Footer}}

Latest revision as of 11:25, 11 May 2009


AddSchedule

A schedule allows you to fire a lua function, after waiting x number of seconds.

Usage

AddSchedule(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

AddSchedule must refer to a user-defined lua function.

AddSchedule( "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