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