From WikiChip
Difference between revisions of "mirc/commands/hinc"
(Created page with "The '''/hinc command''' increases the value of a key by [num]. If the value is not specified, the default value is 1.0. == Synopsis == /hinc [-mszu#] <nowiki><table></nowiki...") |
(No difference)
|
Revision as of 05:01, 4 December 2013
The /hinc command increases the value of a key by [num]. If the value is not specified, the default value is 1.0.
Synopsis
/hinc [-mszu#] <table> <key> [num] /hinc -b[cmszu#] <table> <key> <&bvar>
Switches
- -m - Creates the hash table if it does not exist
- -s - Displays the assignment information
- -b - Treats the value as a binary variable
- -c - Truncates the &bvar at the first null value
- -z - Decreases the value by 1.0 every second; stops at zero
- -u# - Removes the key/value after # seconds
Parameters
- <table> - The handle name of the table to operate on
- <key> - The key associated with the value
- [num] - The value to decrease the value by
- <&bvar> - The binary variable value to decrease the value by
Example
Example 1:
alias example { ;create the table hmake -s example ;add a few items hadd example item1 4 hadd example item2 7 hadd example item3 9 ; print the items echo -a item1 = $hget(example, item1) echo -a item2 = $hget(example, item2) echo -a item3 = $hget(example, item3) ; increase the values hinc example item1 5 hinc example item2 12 hinc example item3 1 echo -e - ; print the items echo -a item1 = $hget(example, item1) echo -a item2 = $hget(example, item2) echo -a item3 = $hget(example, item3) ;cleanup hfree -s example }
A counter example:
alias countup { ;adds the item up with a value of 0 to the table count hadd -m count up 0 echo -a $hget(count,up) $+ ! :repeat ;checks if the value of down returns true if ($hget(count,up) < 9) { ;increases down by 1 hinc count up ;echos the current count echo -a $hget(count,up) $+ ! ;repeats goto repeat } ;if the previous if statement returns false it carries on with this. else echo -a 10, done! hfree -s count }
Compatibility
Added: mIRC v6.0
Added On: 03/02/2002
Note: Individual switches were not taken into consideration.