Im trying to make a pictionary. i need a way to have a delay while not pausing the whole bot. what shoudl i do. also when the code it sover the bto crashes. This is what ive got (not finished so dont ecpect functionality)
it hasnt got anything else yet but i need a way to pause while not freezing the whole bot and y is the bot crashing (YE SI MEAN the bot not the command) after the command is over???? Plz help. O and by the way. if my bot hasnt been on for a while its coz it is a bit buggy coz this command aint working. its made it unstable, so it will b back on soon if i get help
A good reason that the bot would crash is because of this:
Quote:
select(undef, undef, undef, 15);;
That would get you what's called a "syntax error" - if you had run your bot through command prompt--like you're SUPPOSED to--you would have seen that error. And it would even tell you what line it's on so you can go and fix it.
And as for your delaying process, you might try something like this:
Code:
# To delay for 30 seconds.<br />&doSleep(30);<br /><br />########################<br /><br /># Subroutine to make the bot pause while still being "alive"<br />sub doSleep {<br /> my $time = shift;<br /><br /> # Expiration time = current time + sleep time.<br /> my $expire = time() + $time;<br /><br /> # Loop internally until the time expires.<br /> while (time() <= $expire) {<br /> $msn->do_one_loop();<br /> }<br /><br /> return;<br />}
So that will make $msn go on a smaller internal loop (being able to continue staying online and receive messages), and when the time has expired the subroutine will finally return, allowing the caller code to continue. Long story short, it will do what you want it to. _________________ Current Site (2008) http://www.cuvou.com/
Joined: 19 Jul 2004 Posts: 556 Location: Los Angeles, CA votes: 1
Posted: Mon Mar 21, 2005 6:43 pm Post subject:
QUOTE(Cer @ Mar 21 2005, 04:57 AM)
A good reason that the bot would crash is because of this:
Quote:
select(undef, undef, undef, 15);;
That would get you what's called a "syntax error"
[right][snapback]47104[/snapback][/right]
Cer, did you even try that code or are you just trying to prove your sig right
select RBITS,WBITS,EBITS,TIMEOUT
there is nothing wrong with select(undef, undef, undef, 15);;
its used alot of times to "sleep" for less than one second and if your saying the extra ; you can have as many of those as you want it makes no diffrence
This is what we call "Correct syntax" if you would test things that you think are errors like you're SUPPOSED to--....