Project

General

Profile

Actions

Hdec » History » Revision 4

« Previous | Revision 4/6 (diff) | Next »
Per Amundsen, 12/30/2018 11:46 PM


Added in 1.9.0

/hdec [-bcmsuNzB] <name> <item> [num | &binvar]

Decreases the value of the item by 'num'.

Switches

-b - Indicates &binvar is set.
-c - Chop the &binvar to first null byte.
-m - Creates the table if it does not exist.
-s - Displays the result.
-uN - Unset the the item after N seconds.
-z - Decreases the item once per second until it reaches zero and then unsets it.
-B - Performs a $calcint calculation instead of regular $calc when arithmetic operators are used. (AdiIRC only)

Parameters

<name> - The hashtable where the item resides.
<item> - The hashtable item to decrease.
[num | &binvar] - The number or &binvar to decrease by.

Example

alias countdown {
  ;Adds the item down with a value of 10 to the table count.
  hadd -m count down 10

  echo -a $hget(count,down) $+ !
  :repeat

  ;Checks if the value of down returns true.
  if ($hget(count,down) > 1) {
    ;decreases down by 1
    hdec count down
    ;echos the current count
    echo -a $hget(count,down) $+ !
    ;repeats
    goto repeat
  }
  ;If the previous if statement returns false it carries on with this.
  else echo -a 0, Hurray!
  hfree -s count
}

Updated by Per Amundsen over 5 years ago · 4 revisions

Also available in: PDF HTML TXT