Hinc » History » Version 4
Per Amundsen, 12/14/2019 09:39 AM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | 3 | Per Amundsen | */hinc [-bcmsuNzB] <name> <item> [num | &binvar]* |
4 | 1 | Per Amundsen | |
5 | Increases the value of the item by 'num'. |
||
6 | |||
7 | *Switches* |
||
8 | |||
9 | 4 | Per Amundsen | -b - Indicates &binvar is set. |
10 | -c - Chop the &binvar to first null byte. |
||
11 | -m - Creates the table if it does not exist. |
||
12 | -s - Displays the result. |
||
13 | -uN - Unsets the item after N seconds. |
||
14 | -z - Decreases the item once per second until it reaches zero and then unsets it. |
||
15 | -B - Performs a [[$calcint]] calculation instead of regular [[$calc]] when arithmetic operators are used. *(AdiIRC only)* |
||
16 | 1 | Per Amundsen | |
17 | *Parameters* |
||
18 | |||
19 | <name> - The hashtable where the <item> is stored. |
||
20 | <item> - The hashtable item to increase. |
||
21 | [num | &binvar] - The number or &binvar to increase by. |
||
22 | |||
23 | *Example* |
||
24 | |||
25 | <pre> |
||
26 | alias example { |
||
27 | ;Create a hashtable. |
||
28 | /hmake -s example |
||
29 | |||
30 | ;Add a few items. |
||
31 | /hadd example item1 4 |
||
32 | /hadd example item2 7 |
||
33 | /hadd example item3 9 |
||
34 | |||
35 | ;Print the items. |
||
36 | /echo -a item1 = $hget(example, item1) |
||
37 | /echo -a item2 = $hget(example, item2) |
||
38 | /echo -a item3 = $hget(example, item3) |
||
39 | |||
40 | ;Increase the values. |
||
41 | /hinc example item1 5 |
||
42 | /hinc example item2 12 |
||
43 | /hinc example item3 1 |
||
44 | |||
45 | /echo -e - |
||
46 | |||
47 | ;Print the items. |
||
48 | /echo -a item1 = $hget(example, item1) |
||
49 | /echo -a item2 = $hget(example, item2) |
||
50 | /echo -a item3 = $hget(example, item3) |
||
51 | |||
52 | ;Cleanup. |
||
53 | /hfree -s example |
||
54 | } |
||
55 | </pre> |