Page 1 of 1

Kill timer

Posted: 12 May 2014 15:31
by Caw
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?

Re: Kill timer

Posted: 12 May 2014 16:13
by Greneth
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.

Re: Kill timer

Posted: 12 May 2014 17:09
by Jhael
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.

Re: Kill timer

Posted: 12 May 2014 17:17
by Caw
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.

Re: Kill timer

Posted: 12 May 2014 17:20
by Jhael
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.

Re: Kill timer

Posted: 13 May 2014 03:21
by Yanus
.

Re: Kill timer

Posted: 13 May 2014 18:54
by Caw
Thanks Yanus! This works perfectly.

Re: Kill timer

Posted: 23 May 2015 19:16
by kirsach
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

Re: Kill timer

Posted: 24 May 2015 01:32
by Vlek
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 + '.');