Project

General

Profile

Hdec » History » Version 4

Per Amundsen, 12/30/2018 11:46 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
-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 - Unset the the item after N seconds.
14
-z - Decreases the item once per second until it reaches zero and then unsets it.
15 4 Per Amundsen
-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 resides.
20
<item> - The hashtable item to decrease.
21
[num | &binvar] - The number or &binvar to decrease by.
22
23
*Example*
24
25 2 Per Amundsen
<pre>
26 1 Per Amundsen
alias countdown {
27
  ;Adds the item down with a value of 10 to the table count.
28
  hadd -m count down 10
29
30
  echo -a $hget(count,down) $+ !
31
  :repeat
32
33
  ;Checks if the value of down returns true.
34
  if ($hget(count,down) > 1) {
35
    ;decreases down by 1
36
    hdec count down
37
    ;echos the current count
38
    echo -a $hget(count,down) $+ !
39
    ;repeats
40
    goto repeat
41
  }
42
  ;If the previous if statement returns false it carries on with this.
43
  else echo -a 0, Hurray!
44
  hfree -s count
45
}
46 2 Per Amundsen
</pre>