Ryzom AMS Plugin Hooks
- 1 Ryzom AMS Plugin Hooks
- 1.1 Info
- 1.1.1 documentation notes
- 1.1.1.1 variable param_list
- 1.1.1.2 return
- 1.1.2 Global Variables
- 1.1.1 documentation notes
- 1.2 User Hooks
- 1.3 Admin Hooks
- 1.4 Time Hooks
- 1.4.1 Hook_Cron
- 1.4.1.1 Hook_Cron definition
- 1.4.1.2 variable Type
- 1.4.1.3 return
- 1.4.1 Hook_Cron
- 1.5 Display Hooks
- 1.1 Info
Ryzom AMS Plugin Hooks
Info
documentation notes
All hooks are designed with the following structure
$pluginname_hook_name
The plugin name is defined in the plugin.info
The plugin name matches the folder it installs to
Hooks are documented in the following way
First code block is the psudo code defination, this defines the input and output
param_list = Array()
function func_check takes param_list, boolean returns integer(min = 0, max = 5)
variable_declaration $username
variable_declaration $permissions
...
statement
param_list[time] set to 0
...
statement
return false if $permissions < 3
...
endfunctionfollowing code blocks are assigned a preceding "type"
array's are formatted in the print_r style
global helper variables are preceded with $
variable param_list
Array
(
[time] => integer(min = 0, max = 100)
[name] => string(maxchar(32))
[values] => Array
(
[0] => $username
[1] => $permissions
)
)return
Value definitions
1 = true
2 = false
3 = run again
4 = failed
5 = test succeededGlobal Variables
$username = current users username
$permissions = permissions value
$current_time = current unix timestamp
$pluginname = name of plugin
User Hooks
Admin Hooks
Time Hooks
Hook_Cron
Hook_Cron definition
type = integer(min = 0, max = 1, default = 0)
last_run = integer
pulled from lib_database table cron column lastrun
time_delta = integer
pulled from lib_database table plugins column $pluginname_cron_name_delta
cron_function = string
function name to run when cron should be activated
function Hook_Cron takes type, time_delta, cron_name returns integer(min = 0, max = 3)
variable_declaration $current_time
...
statement
if $current_time > last_run + time_delta then return(3)
else
run cron_function
statement
if cron is running then return(2)
statement
function failed return 0
function succeeded return 1
...
endfunctionvariable Type
0 = normal run
1 = force runreturn
Value definitions
0 = cron failed
1 = cron succeeded
2 = cron running
3 = cron doesn't need to runDisplay Hooks