What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Time since bot started?

Inrego

New Member
Joined
Feb 7, 2010
Messages
2,765
Reaction score
71
Hey is there any way to call some timer which shows the amount of time gone since the bot was started? So I can make something like GB2's status report.
 
maybe use something to trigger the timer ( some sort of start button ) with System.DateTime.TimeOfDay something something ( i suck @ C# )
 
Code:
var startTime = DateTime.Now; //Record at Init. 
var lengthRunning = (DateTime.Now - startTime);
Logging.Write(Color.Plurple, "I have been dying and sucking for: " + lengthRunning.TotalMinutes().ToString());
 
Hmm, I'm trying to make this in PB. The only variables available to use here are var1, var2.... varn
Additionally, when I use them I have to write their type in front of them - for example (string)var3
When I do this I don't seem to be able to use the .TotalMinutes() or .ToString() - it's giving me some errors.
Any ideas on this?
 
Using it like this in an custom action
Code:
var startTime = DateTime.Now; var lengthRunning = (DateTime.Now -  startTime); Logging.Write(Color.Purple, "I have been dying and sucking  for: " + lengthRunning.TotalMinutes.ToString());

works, just 4 everyone to see
 
Last edited:
Aha, I was breaking it into several custom actions :P

On a second thought.
I don't think that'll work. First, because I do need to execute the lines at 2 different places. 1 at the beginning and 1 when I want to check the time.

EDIT: I made one custom action like this
Code:
var startTime = DateTime.Now;
and then later when I want to check the time, I made another one like this:
Code:
var lengthRunning = (DateTime.Now - startTime); Logging.Write(Color.Purple, "I have been dying and sucking for: " + lengthRunning.TotalMinutes.ToString());

I'm getting this error:
Code:
The name 'startTime' does not exist in the current context
 
Last edited:
mmmh Inrego and his special needs :cool:

Yea - I like to fiddle around with my profiles and add some nice extra touches which makes them special and lovable! :D
btw - I edited previous post. (again)
 
you would need something like

if bot is running then save the local time into a var and if the bot stopped( or some other event happens) use saved var and do something awesome with it - i think
 
Nah I don't need to show it when the bot stops. Just at vendor runs or something like that.
 
View attachment 29689






this doesn't work either

can i even store this type of data into var1 var2 and so on?

*coding makes me wanna break ma computer DOH*
 
Last edited:
View attachment 29689

this doesn't work either


can i even store this type of data into var1 var2 and so on?
I'm quite surprised you didn't get errors in the line
Code:
var2 = (DateTime.Now - var1);
I'm quite sure that I did because you have to specify a type for the var1, that'd make it something like
Code:
var2 = (DateTime.Now - (DateTime)var1);
I'm not sure though.
 
Your gonna have to take Now.hour and now.minute and save them.
Then on an event you'll have to compare them.
You can't take a current time, which is actually 3+ variables (hr,min,sec) and subtract from it.
 
Ah, alright. I should be able to get that working - thanks!
 
Might also want to get the day...


So 25th on startTime
26th currenttime
take: 24/*being 24 hrs*/ - startTime.hour + (currentTime.hour)
 
Code:
Logging.Write(Color.Purple, "Blah blah {0:D2} days, {1:D2} hours, {2:D2} minutes, {3:D2} seconds", var2.Days, var2.Hours, var2.Minutes, var2.Seconds);

Make sure your "var1" is
Code:
var var1 = DateTime.Now;

And
Code:
var var2 = DateTime.Now - var1;
 
In PB:

var1 = DateTime.Now

var2 = DateTime.Now - (DateTime)var1;

Logging.Write(Color.EatMe, "I have been stroking off Bossland for: " + (TimeSpan)var2.TotalMinutes().ToString());
 
Last edited:
Back
Top