Author |
Message |
Chebby Guest
Offline
|
Posted: Sat Jan 22, 2005 5:21 am Post subject: Making bot wait for 10 seconds? |
 |
|
|
|
How do I make a bot wait for 10 seconds? I tried C++'s Sleep(1000); but that didn't work. Can anyone help? |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sat Jan 22, 2005 5:47 am Post subject: |
 |
|
|
|
That'd be Sleep(10000), but you should use the ticker (in MERVbot) instead of Sleep(). |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sat Jan 22, 2005 10:14 am Post subject: |
 |
|
|
|
I'm sure somebody will correct me, but I believe sleep makes the current thread inactive for the specified amount of time. This might mean you don't send or receive packets (depending on how merv is threaded, I haven't looked), so I would go with Solo and use EVENT_Tick. _________________
 |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sat Jan 22, 2005 5:40 pm Post subject: |
 |
|
|
|
Definitely do not use Sleep(). But also I would not use tick events. This requires polling. If you have 10 bots with 10 modules each, that's 100 polls per tick. What a waste of CPU. _________________ 4,691 irradiated haggis! |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sat Jan 22, 2005 11:22 pm Post subject: |
 |
|
|
|
MERV sends an EVENT_Tick every second anyway. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Jan 23, 2005 2:23 am Post subject: |
 |
|
|
|
Bak wrote: | he's not running 10 bots with 10 copies of the exact module. He's running one bot with one version of the module -> 1 poll per tick |
I was being hypothetical. The point is: the proper place for time checking is in the core, with events to notify modules. Using this method, the core can poll a single interval per tick and notify modules accordingly. |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Sun Jan 23, 2005 3:28 am Post subject: |
 |
|
|
|
I found powerbot's timer methods much handier that mervbots. But yah, in mervbot you need to use event_tick, its called once every second (or close to it depending on how often control is returned to the core).
So a posibility is to have a variable in event_tick that increments each time the event is run and keep track of the time that way. Use of the sleep() function will cause your bot to lag out. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Jan 23, 2005 4:53 am Post subject: |
 |
|
|
|
You can't really rely on events coming at any particular rate. Timing 10 events that are supposed to occur every second will not guarantee a 10 second interval. If you don't need that kind of precision, then I guess it's fine, but it still means polling of a kind (checking your own counter every tick). |
|
Back to top |
|
 |
Underlord Novice
Gender: Joined: Feb 17 2004 Posts: 55 Offline
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Jan 23, 2005 2:33 pm Post subject: |
 |
|
|
|
Exactly what I was saying NOT to do. |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sun Jan 23, 2005 2:35 pm Post subject: |
 |
|
|
|
thats how merv does it, if you want people to do it right, you should just give us all a copy of powerbot  |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sun Jan 23, 2005 2:36 pm Post subject: |
 |
|
|
|
Instead of saying what not to do, could you tell him then how to do it right? |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Jan 23, 2005 2:58 pm Post subject: |
 |
|
|
|
@Solo: Ekted wrote: | The point is: the proper place for time checking is in the core, with events to notify modules. Using this method, the core can poll a single interval per tick and notify modules accordingly. |
I'm not sure if I understand you correctly, Ekted, but isn't that what MERV does? |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sun Jan 23, 2005 3:05 pm Post subject: |
 |
|
|
|
Meh, sorry, I thought I read that part of this thread already.
I think he means the core should do the time checking and notify the plugins when it's supposed to, instead of notifying the plugins each tick to let them run a timer seperately. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Jan 23, 2005 7:54 pm Post subject: |
 |
|
|
|
Yes. Powerbot has a SetTimer() call. The core manages all the timers sorted by time, so it only needs to check the shortest one. Even if there are 100 different timers going for all the modules, there's only ever 1 poll unless a bunch of timers trigger at the same time. Merv could do this. |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sun Jan 23, 2005 7:57 pm Post subject: |
 |
|
|
|
like I said, hook us up and put an end to such nonsense  |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Jan 23, 2005 8:16 pm Post subject: |
 |
|
|
|
Ekted wrote: | Merv could do this. |
But Catid is depressed about (read: has given up on?) MERV.  |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sun Jan 23, 2005 8:38 pm Post subject: |
 |
|
|
|
Uh, what? Catid's stopping with Merv? |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Jan 23, 2005 10:39 pm Post subject: |
 |
|
|
|
No, just every time I've talked to him, he's said that he hates MERV. That plus the fact that he hasn't replied to an email i sent him about a source code improvement and no new updates makes me think he's not going to actively develop it anymore. Also, notice that all the recent changes in Changelog.txt are other people's/bugfixes. |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Mon Jan 24, 2005 6:18 am Post subject: |
 |
|
|
|
He stopped working on it a while ago. Last I talked to him he was working on a game with his friend, but the new semester started so he is probably busy with Eletrical Engeneering classes. Id be sick of merv too if I got junk mail from newbs all the time; instead I get a lot of email about making my shlong bigger. Powerbot is better than merv in many ways but requires a deeper understanding on how the game works. Switching from merv to powerbot is a little wierd, as it handles data a little differently, but overall they have a lot of people willing to help out and one very well documented header file; every line is commented and clear as to its purpose. It also has mysql support; that alone pretty much blows merv out of the water. |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Mon Jan 24, 2005 2:40 pm Post subject: |
 |
|
|
|
Dr Brain swears by mysql |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Jan 24, 2005 4:42 pm Post subject: |
 |
|
|
|
I like MySQL for what one does with it. I mean for a zone, for a local website, etc. it's fine. If you're running a corporation, etc. another DBMS, like Oracle, is much more appropriate. lol. _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Mon Jan 24, 2005 11:52 pm Post subject: |
 |
|
|
|
doesn't oracle cost like $80,000 for a single license? |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Tue Jan 25, 2005 7:49 am Post subject: |
 |
|
|
|
I like MySQL for storing dynamic data.
If I were running a corperation, I'd probably look into PostgreSQL. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
|