Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Making bot wait for 10 seconds?
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  IM looking for a certian bot plugin ca... Post :: Post Request  View next topic  
Author Message
Chebby
Guest


Offline

PostPosted: Sat Jan 22, 2005 5:21 am    Post subject: Making bot wait for 10 seconds? Reply to topic Reply with quote

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:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sat Jan 22, 2005 5:47 am    Post subject: Reply to topic Reply with quote

That'd be Sleep(10000), but you should use the ticker (in MERVbot) instead of Sleep().
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sat Jan 22, 2005 10:14 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sat Jan 22, 2005 5:40 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Jan 22, 2005 11:22 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sun Jan 23, 2005 12:29 am    Post subject: Reply to topic Reply with quote

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
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sun Jan 23, 2005 2:23 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Sun Jan 23, 2005 3:28 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sun Jan 23, 2005 4:53 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Underlord
Novice


Gender:Gender:Male
Joined: Feb 17 2004
Posts: 55
Offline

PostPosted: Sun Jan 23, 2005 7:43 am    Post subject: Reply to topic Reply with quote

Code: Show/Hide

// spawn.h

        class botInfo
        {
        int countdown[1]; 

                public:
                botInfo(CALL_HANDLE given)
                {
                countdown[0] = 10;   // initially starts at 10 seconds

//spawn.cpp

            case EVENT_Tick:   // called once a second
            {
                for (int i = 0; i < 1; ++i)
                    --countdown[i];

                if (countdown[0] == 0) // 10 seconds have passed
                {
                   countdown[0] = 10;  // reset timer
                   // insert code that happens every 10 seconds here
                }
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sun Jan 23, 2005 2:33 pm    Post subject: Reply to topic Reply with quote

Exactly what I was saying NOT to do.
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sun Jan 23, 2005 2:35 pm    Post subject: Reply to topic Reply with quote

thats how merv does it, if you want people to do it right, you should just give us all a copy of powerbot biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sun Jan 23, 2005 2:36 pm    Post subject: Reply to topic Reply with quote

Instead of saying what not to do, could you tell him then how to do it right?
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Jan 23, 2005 2:58 pm    Post subject: Reply to topic Reply with quote

@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
View users profile Send private message Add User to Ignore List Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sun Jan 23, 2005 3:05 pm    Post subject: Reply to topic Reply with quote

Meh, sorry, I thought I read that part of this thread already. sa_tongue.gif

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
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sun Jan 23, 2005 7:54 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sun Jan 23, 2005 7:57 pm    Post subject: Reply to topic Reply with quote

like I said, hook us up and put an end to such nonsense biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Jan 23, 2005 8:16 pm    Post subject: Reply to topic Reply with quote

Ekted wrote:
Merv could do this.

But Catid is depressed about (read: has given up on?) MERV. icon_sad.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sun Jan 23, 2005 8:38 pm    Post subject: Reply to topic Reply with quote

Uh, what? Catid's stopping with Merv?
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Jan 23, 2005 10:39 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Mon Jan 24, 2005 6:18 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Jan 24, 2005 2:40 pm    Post subject: Reply to topic Reply with quote

Dr Brain swears by mysql
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Mon Jan 24, 2005 4:42 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Jan 24, 2005 11:52 pm    Post subject: Reply to topic Reply with quote

doesn't oracle cost like $80,000 for a single license?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Jan 25, 2005 7:49 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 157 page(s) served in previous 5 minutes.

phpBB Created this page in 0.493518 seconds : 49 queries executed (91.5%): GZIP compression disabled