Kill timer

General discussion about the Genesis Web Client located at https://www.genesismud.org/play/

Moderator: Eowul

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.
Post Reply
Caw
Beginner
Posts: 15
Joined: 07 Feb 2014 18:12

Kill timer

Post by Caw » 12 May 2014 15:31

I wanted to run some experiments and I was trying to figure out a way to collect the time it takes to kill a mob. Any thoughts on the best way to do this? And if its possible to have it output to a file?

Greneth

Re: Kill timer

Post by Greneth » 12 May 2014 16:13

Don't have access to cmud right now but there is a way to timestamp every line/command. From there a simple #capture will pull it to another window. Can change the settings to log that window and review.

Jhael
Adept
Posts: 133
Joined: 26 Sep 2011 05:33

Re: Kill timer

Post by Jhael » 12 May 2014 17:09

If you have CMUD, you can create a trigger that fires off "you attack the *" that kicks of a tick timer. Set another trigger to fire off of "you killed the" that stops that time. Done deal.

If you want more granular measurement, I'm fairly sure you could increment the timer every half second, quarter second, etc.

Caw
Beginner
Posts: 15
Joined: 07 Feb 2014 18:12

Re: Kill timer

Post by Caw » 12 May 2014 17:17

Thanks for the input guys and I dont mean to sound ungrateful but I put this in the Genesis Web client forum because I am trying to figure out how to do it with the Web client. I use CMud at home and am confident I could figure out a way to do it with that program. However I am at work where I use the Web client and scripting in it and Javascript is a whole different beast.

Jhael
Adept
Posts: 133
Joined: 26 Sep 2011 05:33

Re: Kill timer

Post by Jhael » 12 May 2014 17:20

Caw wrote:Thanks for the input guys and I dont mean to sound ungrateful but I put this in the Genesis Web client forum because I am trying to figure out how to do it with the Web client. I use CMud at home and am confident I could figure out a way to do it with that program. However I am at work where I use the Web client and scripting in it and Javascript is a whole different beast.
Oops. Of course you did. I completely forgot what forum this was in. Sorry about that. There absolutely should be a way to create a solution similar to the one I described for CMUD....but I am no help in figuring it out.

Yanus
Adventurer
Posts: 95
Joined: 08 Mar 2010 15:58

Re: Kill timer

Post by Yanus » 13 May 2014 03:21

.
Last edited by Yanus on 30 May 2014 01:29, edited 1 time in total.

Caw
Beginner
Posts: 15
Joined: 07 Feb 2014 18:12

Re: Kill timer

Post by Caw » 13 May 2014 18:54

Thanks Yanus! This works perfectly.

User avatar
kirsach
Wanderer
Posts: 67
Joined: 23 Sep 2014 20:33

Re: Kill timer

Post by kirsach » 23 May 2015 19:16

Caw wrote:Thanks Yanus! This works perfectly.
Hi Caw

Do you stil have the code proposed by Yanus? if yes, can you post it once again?
Thanks

User avatar
Vlek
Wanderer
Posts: 71
Joined: 06 Apr 2014 07:40
Contact:

Re: Kill timer

Post by Vlek » 24 May 2015 01:32

kirsach wrote:Do you stil have the code proposed by Yanus? if yes, can you post it once again?
Thanks
Sorry man, I'm in the dark as much as you are as far as what was posted, but I do know of a way to do that. You'd use javascript date objects as timestamps and compare them. I'd suggest making an alias for "kill" that starts the timer, and a trigger for "you killed" that creates another timestamp that is then compared and either print it out or save it to create an average time for a given mob. However, if you were going to do the averaging, I'd suggest also creating a trigger for "you attack" that'll grab the whole name of the mob to save it under. Since it's only saving a timestamp when you use "kill", you don't have to worry if you don't find anything to attack. It'll just make a new one when you attack something else. It's not like it'll continue counting anything in the background.

If all you wanted to do was print the time it took, here's a way to do it:

Your kill alias would look like this:
Alias: kill

Code: Select all

if ( args[1] !== undefined){ // gotta make sure we're not just typing 'kill'
  gwc.userdata.last_target = args[1];
  gwc.userdata.attack_starttime = new Date();
  gwc.connection.send( args[0] );
}
else{ 
  gwc.connection.send( 'kill', false ); 
}
Your "you killed" trigger would look something like this:
Trigger: ^You killed
Type: Regex

Code: Select all

var currentTime = new Date();
var killTime = ((currentTime - gwc.userdata.attack_starttime) / 1000).toFixed(2); 
//This is a string representation that wouldn't be very good in averaging, you'd probably just save the difference between now and when you started instead.
gwc.output.append( 'It look ' + killTime + ' seconds to kill ' + gwc.userdata.last_target + '.');

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/