Script: Counting your forgings
Posted: 30 Aug 2013 19:23
For those Blacksmiths out there, I present you with this trigger and alias that will automatically count the number of items you have forged. Due to the server persistency, this number will be available no matter where you login.
Example of the trigger:
And of the alias:
If you want to initialize the amounts with values you've written down yourself, you can use
If you use the word remove instead of the number, that specific item gets removed from the list again. Make sure to enter item names in quotes if they contain spaces.
To configure, create a trigger, set it's type to "regexp" and use the following pattern:
Then, paste the following code in the script window and set the type to 'javascript':
Now, create an alias, name it "forgecount" and paste the following code in the script window, again set the type to javascript:
Example of the trigger:
Code: Select all
You have finished forging the platemail greaves.
>>> Total: 101 platemail greaves
Code: Select all
You have forged the following amounts:
1 boots
10 stiletto
1 bracers
101 platemail greaves
Code: Select all
forgecount "item name" 12345
To configure, create a trigger, set it's type to "regexp" and use the following pattern:
Code: Select all
^You have finished forging the (.*)\.$
Code: Select all
if (gwc.userdata.forging === undefined) gwc.userdata.forging = {};
if (gwc.userdata.forging[args[1]] === undefined) gwc.userdata.forging[args[1]] = 0;
gwc.userdata.forging[args[1]]++;
gwc.output.append(">>> Total: " + gwc.userdata.forging[args[1]] + " " + args[1]);
gwc.output.color("#0053B3");
Code: Select all
if (args[1] !== undefined) {
if (args[2] == "remove") {
gwc.output.append("Removed forge count for " + args[1]);
delete gwc.userdata.forging[args[1]];
} else if ($.isNumeric(args[2])) {
gwc.output.append("Set forge count for " + args[1] + " to " + args[2]);
gwc.userdata.forging[args[1]] = parseInt(args[2], 10);
} else {
gwc.output.append("Usage: forgecount \"item\" count/remove");
}
return;
}
if (gwc.userdata.forging === undefined) {
gwc.output.append("No forgings have been counted.");
return;
}
gwc.output.append("You have forged the following amounts:");
gwc.output.color("#0053B3");
for (var key in gwc.userdata.forging) {
var count = gwc.userdata.forging[key].toString();
gwc.output.append(" ".substring(count.length) + count + " " + key);
}