Page 1 of 2

Script: Counting your forgings

Posted: 30 Aug 2013 19:23
by Eowul
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:

Code: Select all

You have finished forging the platemail greaves.
>>> Total: 101 platemail greaves
And of the alias:

Code: Select all

You have forged the following amounts:
    1  boots
   10  stiletto
    1  bracers
  101  platemail greaves
If you want to initialize the amounts with values you've written down yourself, you can use

Code: Select all

forgecount "item name" 12345
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:

Code: Select all

^You have finished forging the (.*)\.$
Then, paste the following code in the script window and set the type to 'javascript':

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");
Now, create an alias, name it "forgecount" and paste the following code in the script window, again set the type to javascript:

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);
}

Re: Script: Counting your forgings

Posted: 31 Aug 2013 09:36
by Makfly
That's pretty neat for the smiths in Genesis, but I cant help wonder why it isn't just coded in the actual game, instead of a Wizard coding it only for a client?

Only argument I can think of right now, is that the Admin wants players to migrate to the official client, and are therefore trying to sweeten the deal by catering to the client rather than the game. Which would be a fair enough, if everyone used the same client, there would be less "outside advantages" like insta-travel via maps, bot-scripts and whatever, but if the Admin doesn't care which client players use, then global, general features like this smith-counter, might as well be available to everyone in-game.

Re: Script: Counting your forgings

Posted: 31 Aug 2013 09:59
by Eowul
Makfly wrote:That's pretty neat for the smiths in Genesis, but I cant help wonder why it isn't just coded in the actual game, instead of a Wizard coding it only for a client?
Genesis as a rule does not display such numbers, that's why it's not available in game. I "coded" this as an example of things that are possible with server persistent triggers, aliases and userdata.
Makfly wrote:Only argument I can think of right now, is that the Admin wants players to migrate to the official client, and are therefore trying to sweeten the deal by catering to the client rather than the game. Which would be a fair enough, if everyone used the same client, there would be less "outside advantages" like insta-travel via maps, bot-scripts and whatever, but if the Admin doesn't care which client players use, then global, general features like this smith-counter, might as well be available to everyone in-game.
/me hands Makfly a tinfoil hat.

Re: Script: Counting your forgings

Posted: 31 Aug 2013 11:43
by Makfly
eowul wrote:Genesis as a rule does not display such numbers, that's why it's not available in game. I "coded" this as an example of things that are possible with server persistent triggers, aliases and userdata.
The official game client does not abide by the same rules as the game?
Okay, a bit weird, but I have no problem with that.
eowul wrote: /me hands Makfly a tinfoil hat.
Huh?

Re: Script: Counting your forgings

Posted: 02 Sep 2013 09:48
by Laurel
eowul wrote:I "coded" this as an example of things that are possible with server persistent triggers, aliases and userdata.
First time in my Genesis life I have a killcount ... never bothered to create one before. Thank you :)
And it's right away all-game total, not just per session ;p

Code: Select all

You killed the swift bicorn.
>>> Total: 3 the swift bicorn

Re: Script: Counting your forgings

Posted: 12 May 2014 12:02
by Aristos
Is there something similar for herbs?

Re: Script: Counting your forgings

Posted: 12 May 2014 14:53
by Laurel
if I was able to rework this one into a kill count, you can rework it into a herb count ...

Re: Script: Counting your forgings

Posted: 12 May 2014 16:10
by Greneth
Wouldn't it just be easier to use a pouch from the Bree herbalist?

Re: Script: Counting your forgings

Posted: 23 May 2017 15:24
by Kwevin
Is this supposed to persist through multiple logins?

Re: Script: Counting your forgings

Posted: 23 May 2017 16:14
by Tarax the Terrible
Yeah I think so, I'm getting random resets to zero tho. You? Wonder if it's stored in your browser and you need some setting tweak