View unanswered posts | View active topics It is currently 27 Apr 2018 04:33

Forum rules


- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.



Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Script: Counting your forgings 
Author Message
Wizard
User avatar

Joined: 03 Mar 2010 21:55
Posts: 106
Location: Middle Earth
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:
You have finished forging the platemail greaves.
>>> Total: 101 platemail greaves


And of the alias:

Code:
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:
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:
^You have finished forging the (.*)\.$


Then, paste the following code in the script window and set the type to 'javascript':

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

_________________
Caretaker of Arda


30 Aug 2013 19:23
Profile
Champion

Joined: 04 Mar 2010 00:36
Posts: 585
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.

_________________
Mortimor Makfly - Gnomish Xeno-Anthropologist


31 Aug 2013 09:36
Profile
Wizard
User avatar

Joined: 03 Mar 2010 21:55
Posts: 106
Location: Middle Earth
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.

_________________
Caretaker of Arda


31 Aug 2013 09:59
Profile
Champion

Joined: 04 Mar 2010 00:36
Posts: 585
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?

_________________
Mortimor Makfly - Gnomish Xeno-Anthropologist


31 Aug 2013 11:43
Profile
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:
You killed the swift bicorn.
>>> Total: 3 the swift bicorn


02 Sep 2013 09:48
Veteran
User avatar

Joined: 26 May 2013 18:54
Posts: 239
Is there something similar for herbs?


12 May 2014 12:02
Profile
if I was able to rework this one into a kill count, you can rework it into a herb count ...


12 May 2014 14:53
Wouldn't it just be easier to use a pouch from the Bree herbalist?


12 May 2014 16:10
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
Is this supposed to persist through multiple logins?

_________________
Alea iacta est. Serius regredi est.


23 May 2017 15:24
Profile
Myth
User avatar

Joined: 09 Mar 2010 20:33
Posts: 1331
Location: UK
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

_________________
http://genesisquests.pbworks.com/
Join up and help each other with Quests :)


23 May 2017 16:14
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 18 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.