From 68e5cf000bf35688613aca223cb4f6d9fa369094 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Tue, 12 Mar 2013 04:46:30 +0000 Subject: [PATCH] Document what are the return values for a script condition. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@753 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleCondition.lua | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/OvaleCondition.lua b/OvaleCondition.lua index 9934006..2b2dd6d 100644 --- a/OvaleCondition.lua +++ b/OvaleCondition.lua @@ -420,7 +420,44 @@ end -- -- --- Script conditions. +--[[---------------------------------------------------------------------------- + Script conditions. + + A script condition must have a name that is lowercase. Script function + names are always converted to lowercase before comparing against the + conditions in the OvaleCondition.conditions table. + + A script condition can return in two different ways: + + (1) start, ending + This returns a time interval representing when the condition is true + and is used by conditions that return only a time interval. + + (2) start, ending, value, origin, rate + This returns a function f(t) = value + (t - origin) * rate that is + valid for start < t < ending. This return method is used by + conditions that return a value that is used in numerical comparisons + or operations. + + The endpoint of a time interval must be between 0 and infinity, where + infinity is represented by "nil". Time is a value such as returned by + the API function GetTime(). + + Examples: + + (1) (0, nil) means the condition is always true. This can be shortened + to just return 0. + + (2) (nil, nil) means the condition is always false. This can be shorted + to just return nil. + + (3) (0, nil, constant, 0, 0) means the condition has a constant value. + + (4) (start, ending, ending - start, start, -1) means the condition has a + value of f(t) = ending - t, at time t between start and ending. This + basically returns how much time is left within the time interval. +--]]---------------------------------------------------------------------------- + OvaleCondition.conditions = {} -- List of script conditions that refer to a castable spell from the player's spellbook. OvaleCondition.spellbookConditions = { spell = true } -- 1.7.9.5