When this script action is calle,d the function is executed immediately in a new thread, with the character's name passed as a parameter.
The patrol thread may be temporarily paused in certain situations, such as if the character attacks someone else. If the character is killed or otherwise removed from the game, the patrol thread is killed. Also, if for any reason, the patrol thread is killed, it will not be re-started.
Note that, although this script action is primarily intended for setting up patrol routes, it can also be used to execute any character-related function. The term "patrol" is used loosely here.
Patrols cannot be registered to the player character.
Example:
function do_patrol(name)
local route = {"nav00", "nav01", "nav02", "nav03"}
local i = 1
while (1) do
move_to(name, route[i])
i = i + 1
if (i > 4) then
i = 1
end
end
end
patrol("do_patrol", "Guard#000")
Associates the function, do_patrol(), with the character named, "Guard#000". The function is executed immediately in a new thread. The string, "Guard#000", is passed to do_patrol() as a parameter.