backIndex

Xelagot action script

Time-Out lists

These lists must first be declared using the var keyword, as they are not created by default. See Xelagot action script: Variables. They store name-value pairs, and a time-out for the item. The name of the list item must be unique and is case insensitive, and to each name you may attach a string value (called the value) and a time-out value in seconds (called the time-out). The name may contain any printable character except for the equal sign "=", which will be replaced by an underscore "_".
For example, you can create a time-out list called /t_citnums:
var /t_citnums
   

As from X1 2.9999975 and Av99bot/SrvcXlgBot 2.8 onwards, you can pack the name of a timeout list into a string variable, and use it as a substitute. This gives you a lot of flexibility when you need to apply the same operations to different lists. For example:

var /t_TOut1, /t_TOut2
# instead of
# TListClear /t_TOut1
# TListClear /t_TOut2
# you can write
$a = "/t_TOut1"
TListClear $a
$a = "/t_TOut2"
TListClear $a
   

The following statements apply to these lists:

TListClear /t_citnums clears the list
TListSetTimeout /t_citnums %t assigns a default value to the time-out for each item of the list. Variable or literal %t must be in seconds. On creation, the time-out lists have a default value of 60 seconds item time-out. This default value will only be applied if you do not specify a time-out value when you add a new item to the list.
TListGetTimeout /t_citnums %t Retrieves the value of the default time-out and stores it in variable %t.
x1 2.9999975
TListCount /t_citnums %t
older
TListGetCount /t_citnums %t
Retrieves the number of items in the list and stores it in variable %t.
TItemSet /t_citnums $n $v %t
TItemSet /t_citnums %n $v %t
Adds an item to the list or modifies an existing item. Variables or literals may be used: $n is the name of the item (may be an integer %n), by which the item is identified, $v is the value assigned to that name, %t is the individual time-out for the item, in seconds.
For example (see next example), if you have the citizen number stored in %avatar_citnum and the name stored in $avatar_name, you can create a new list item (or modify an existing item) according to citizen numbers, store the name of the avatar, and tell the script to keep this item for 5 minutes (300 secs). Supposing you had citizen number 299999 stored in %avatar_citnum, and the name Donkey stored in $avatar_name, this would enter a name-value pair of "299999" "Donkey".
$n = %avatar_citnum
TItemSet /t_citnum $n $avatar_name 300
# or from version 2.9993
TItemSet /t_citnum %avatar_citnum $avatar_name 300
   
TItemGet /t_citnums $n $v %t
TItemGet /t_citnums %n $v %t
Gets the value and time-out stored in item named $n (or integer %n) and stores them in variables $v and %t
TItemSetValue /t_citnums $n $v
TItemSetValue /t_citnums %n $v
Sets the value $v for an item named $n (or integer %n). If the item does not exist, it will add the name and its value to the list, and set the default time-out.
TItemGetValue /t_citnums $n $v
TItemGetValue /t_citnums %n $v
Gets the value stored in item named $n (or integer %n) and stores it in variable $v. If the item named $n (or %n) does not exist, it will store an empty string in $v. Note: an empty string stored in $v does not imply that the item does not exist, it could exist and have an empty value.
TItemSetTimeout /t_citnums $n %t
TItemSetTimeout /t_citnums %n %t
Sets the time-out in seconds for an item named $n (or integer %n). If the item does not exist, it will add the name and an empty value to the list, and set the time-out specified. If it exists, it will only modify the time-out
TItemGetTimeout /t_citnums $n %t
TItemGetTimeout /t_citnums %n %t
Gets the actual time-out in seconds stored in item named $n (or integer %n) and stores it in variable %t. This value is actualised with every call, until it reaches 0 by which time the item will be removed. If the item named $n (or %n) does not exist, it will store a zero in %t. A zero value stored in %t implies the item does not exist.
TItemRemove /t_citnums $n
TItemRemove /t_citnums %n
Removes item named $n (or integer %n) from the list, if it exists.


backIndex