(→Synopsis) |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{mirc title|/hdec Command | + | {{mirc title|/hdec Command}} |
− | The '''/hdec | + | The '''/hdec''' command decreases the value of a hashtable item by [num]. If the optional number value is not specified, the default increment value is 1. It uses the same syntax as /hadd except -b's &binvar is the [num] parameter not the destination. |
− | |||
== Synopsis == | == Synopsis == | ||
− | /hdec [- | + | /hdec [-m[N]szuN] <nowiki>‹table›</nowiki> <item> [num] |
− | + | /hdec -b[m[N]szuN] <nowiki>‹table></nowiki> <item> <&bvar> | |
− | /hdec -b[ | ||
− | |||
== Switches == | == Switches == | ||
− | * '''-m''' - Creates the hash table if it does not exist | + | * '''-m[N]''' - Creates the hash table if it does not exist, optionally setting the number of buckets to N. (Valid N 1-10000) |
* '''-s''' - Displays the assignment information | * '''-s''' - Displays the assignment information | ||
− | * '''-b''' - | + | * '''-b''' - uses the .text contents of a &binvar as the [num] parameter. |
− | + | * '''-z''' - After setting the data's value, decreases the value by 1 each second; unsets to prevent the data value being zero or negative | |
− | * '''-z''' - | + | * '''-uN''' - Removes the hashtable item/value after N seconds |
− | * '''- | + | '''Note:''' If hashtable item has a non-zero $hget(table,item).unset property due to using -uN or -z switches when created or modified by /hinc /hdec or /hadd, then /hsave will not save that item to disk without the /hsave -u switch. /hdec preserves any existing unset delay when -z and -uN switches are not used. |
− | |||
== Parameters == | == Parameters == | ||
− | * ''' | + | * '''<nowiki><table></nowiki>''' - The handle name of the table containing the 'item' |
− | * '''< | + | * '''<item>''' - The item name associated with the data value |
− | * '''[num]''' - The value to decrease the value by | + | * '''[num]''' - The optional value by which to decrease the data value. If not present, decreases by 1.0 |
− | * '''<&bvar>''' - The binary variable value to decrease the | + | * '''<&bvar>''' - The binary variable containing the value by which to decrease the 'item' |
+ | == Example == | ||
+ | '''Note:''' For more examples see the {{mIRC|/hinc}} page. /hdec is the same as /hinc except for decrementing by [num] instead of incrementing. | ||
− | |||
<syntaxhighlight lang="mIRC">alias countdown { | <syntaxhighlight lang="mIRC">alias countdown { | ||
;adds the item down with a value of 10 to the table count | ;adds the item down with a value of 10 to the table count | ||
Line 43: | Line 40: | ||
== Compatibility == | == Compatibility == | ||
{{mIRC compatibility|6.0}} | {{mIRC compatibility|6.0}} | ||
− | |||
== See also == | == See also == | ||
− | * | + | * {{mIRC|/hmake}} |
− | * | + | * {{mIRC|/hfree}} |
− | * {{mIRC| | + | * {{mIRC|/hload}} |
− | * {{mIRC| | + | * {{mIRC|/hsave}} |
* {{mIRC|/hadd}} | * {{mIRC|/hadd}} | ||
* {{mIRC|/hdel}} | * {{mIRC|/hdel}} | ||
− | |||
* {{mIRC|/hinc}} | * {{mIRC|/hinc}} | ||
− | * {{mIRC| | + | * {{mIRC|Hash Tables}} |
− | * {{mIRC| | + | * {{mIRC|$hget}} |
− | * {{mIRC| | + | * {{mIRC|$hfind}} |
− | |||
− | |||
− |
Latest revision as of 18:28, 2 May 2023
The /hdec command decreases the value of a hashtable item by [num]. If the optional number value is not specified, the default increment value is 1. It uses the same syntax as /hadd except -b's &binvar is the [num] parameter not the destination.
Synopsis[edit]
/hdec [-m[N]szuN] ‹table› <item> [num] /hdec -b[m[N]szuN] ‹table> <item> <&bvar>
Switches[edit]
- -m[N] - Creates the hash table if it does not exist, optionally setting the number of buckets to N. (Valid N 1-10000)
- -s - Displays the assignment information
- -b - uses the .text contents of a &binvar as the [num] parameter.
- -z - After setting the data's value, decreases the value by 1 each second; unsets to prevent the data value being zero or negative
- -uN - Removes the hashtable item/value after N seconds
Note: If hashtable item has a non-zero $hget(table,item).unset property due to using -uN or -z switches when created or modified by /hinc /hdec or /hadd, then /hsave will not save that item to disk without the /hsave -u switch. /hdec preserves any existing unset delay when -z and -uN switches are not used.
Parameters[edit]
- <table> - The handle name of the table containing the 'item'
- <item> - The item name associated with the data value
- [num] - The optional value by which to decrease the data value. If not present, decreases by 1.0
- <&bvar> - The binary variable containing the value by which to decrease the 'item'
Example[edit]
Note: For more examples see the /hinc page. /hdec is the same as /hinc except for decrementing by [num] instead of incrementing.
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 }
Compatibility[edit]
Added: mIRC v6.0
Added on: 03 Feb 2002
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.