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

Time since bot started?

Lol, not really. Misconceptions about this bot and programming are caused by responses like that. I can't count how many times as I was learning I was turned away from a correct solution by listening to someone who didn't know what they were talking about, instead of trying and investigating for myself.

I'm okay with being told I was wrong about something.
But you went and decided to try to embarrass me.
Apoc already responded after mine, telling them the actual code, which you then copy-pasted in a response to my post, just to be an asshole.

It's okay. You were referred to me by a certain dev for testing/review of my newest project. @that Dev: No.
 
Logging.Write(Color.EatMe, "I have been stroking off Bossland for: " + (TimeSpan)var2.TotalMinutes().ToString());
So you put this in here why?
That doesn't tell you the at all how long ago the bot was started. :)
 
Meh, wasn't my intention, take it as you may.


Also:
Lol, I had already posted the same thing, previously. ;)

So you put this in here why?
That doesn't tell you the at all how long ago the bot was started. :)

look, both of you cut it out.

its fine to be wrong, as long as your willing to admit it and learn from it. no1knowsy did he learned that what he has wasnt correct, and now he knows. there absolutely no reason to keep going after him over posting something that was wrong, since he was the only one at the time willing to toss ideas and information out there to help code this project.

its fine being wrong, thats how you learn.
 
Haven't looked at this for a few days - I've been busy. Whenever I get the time I'll let you know when I've succesfully done it ^^
 
Hmm, apoc and Smarter, have you tried the solutions you gave me? I tried them out and none of them worked for me.
 
Logging.Write(System.Drawing.Color.Orange, "{0} Hours and {1} Minutes since HB was started.", (DateTime.Now - _StartTime).TotalHours.ToString(), (DateTime.Now - _StartTime).TotalHours.ToString()));

This is actually correct. If you don't want a large decimal output change to:

Logging.Write(System.Drawing.Color.Orange, "{0} Hours and {1} Minutes since HB was started.", System.Math.Round((DateTime.Now - _StartTime).TotalHours).ToString(), System.Math.Round((DateTime.Now - _StartTime).TotalMinutes).ToString()));


I had to use it for something.
 
Yea but did you try it out in PB? The types are messing me up there.
 
Custom Action -> "var1 = DateTime.Now;" -- Record Start
Custom Action -> "var2 = (DateTime.Now - (DateTime)var1);" -- Check Time
Custom Action -> "Logging.Write(Color.Red, "Run Time: " + (TimeSpan)var2.TotalHours.ToString());


[This is freehand .. I didn't try it in PB, but should work.]
 
Last edited:
Custom Action -> "var1 = DateTime.Now;" -- Record Start
Custom Action -> "var2 = (DateTime.Now - (DateTime)var1);" -- Check Time
Custom Action -> "Logging.Write(Color.Red, "Run Time: " + (TimeSpan)var2.TotalHours.ToString());

There's a breakdown for PB :)
Smarter, I think we got off on the wrong foot.
 
Doing it exactly like you wrote there, I'm getting the same error that has been troubling me ever since the first clue that was given in this thread:
Code:
'object' does not contain a definition for 'TotalHours' and no extension method 'TotalHours' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
 
PHP:
<?xml version="1.0" encoding="utf-8"?>
<Professionbuddy>
  <CustomAction Code="var1 = DateTime.Now;" />
  <While Condition="true" IgnoreCanRun="True">
    <If Condition="(DateTime.Now - (DateTime)var1).TotalMinutes &gt; 30" IgnoreCanRun="True">
      <CustomAction Code="Lua.DoString(&quot;EatMe();&quot;);" />
    </If>
  </While>
</Professionbuddy>

There you go?
 
PHP:
<?xml version="1.0" encoding="utf-8"?>
<Professionbuddy>
  <CustomAction Code="var1 = DateTime.Now;" />
  <While Condition="true" IgnoreCanRun="True">
    <If Condition="(DateTime.Now - (DateTime)var1).TotalMinutes > 30" IgnoreCanRun="True">
      <CustomAction Code="Lua.DoString("EatMe();");" />
    </If>
  </While>
</Professionbuddy>

There you go?

Hmm.. That does work. So seems the problem comes when trying to convert it to a String?
 
Be very careful with your cast in this code :

PHP:
Custom Action -> "var1 = DateTime.Now;" -- Record Start
Custom Action -> "var2 = (DateTime.Now - (DateTime)var1);" -- Check Time
Custom Action -> "Logging.Write(Color.Red, "Run Time: " + (TimeSpan)var2.TotalHours.ToString());

You are trying to cast a String to a TimeSpan, it's certainly why it doesn't work.

Instead, you have to cast only the var2 like that :

PHP:
Logging.Write(Color.Red, "Run Time: " + ((TimeSpan)var2).TotalHours.ToString());
 
Actually I was just about to post that I figured it out :)
 
Sure thing, as long as it's not like get the coords for all halloween buckets ^^
 
Back
Top