Project

General

Profile

Hdec » History » Version 6

Per Amundsen, 02/16/2023 12:43 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3 4 Per Amundsen
*/hdec [-bcmsuNzB] <name> <item> [num | &binvar]*
4 1 Per Amundsen
5
Decreases the value of the item by 'num'.
6
7
*Switches*
8
9 6 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 | Unset the 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 1 Per Amundsen
19 5 Per Amundsen
*Parameters*
20 1 Per Amundsen
21 6 Per Amundsen
table(ktable).
22
|*Parameter*|*Description*|
23
| <name> | The hashtable where the item resides. |
24
| <item> | The hashtable item to decrease. |
25
| [num <notextile>|</notextile> &binvar] | The number or &binvar to decrease by. |
26 1 Per Amundsen
27
*Example*
28
29 2 Per Amundsen
<pre>
30 1 Per Amundsen
alias countdown {
31
  ;Adds the item down with a value of 10 to the table count.
32
  hadd -m count down 10
33
34
  echo -a $hget(count,down) $+ !
35
  :repeat
36
37
  ;Checks if the value of down returns true.
38
  if ($hget(count,down) > 1) {
39
    ;decreases down by 1
40
    hdec count down
41
    ;echos the current count
42
    echo -a $hget(count,down) $+ !
43
    ;repeats
44
    goto repeat
45
  }
46
  ;If the previous if statement returns false it carries on with this.
47
  else echo -a 0, Hurray!
48
  hfree -s count
49
}
50 2 Per Amundsen
</pre>