User Control Panel
Advertisements

HELP US, HELP YOU!

Refreshing variables

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Mon Mar 14, 2005 12:17 pm    Post subject: Reply with quote

I have this variable in a sub

Code:
our @bl_list = $msn->getContactList('BL');


Every time the sub is called i want it to refresh, but it doesn't seem to.

Anyideas?
Back to top
..::BIGmouth( )::..
God Like
God Like


Joined: 05 Feb 2004
Posts: 801

Reputation: 44.1Reputation: 44.1Reputation: 44.1Reputation: 44.1

PostPosted: Mon Mar 14, 2005 12:19 pm    Post subject: Reply with quote

Chage our into "my".
Or do...
Code:
my @bl_list;<br />@bl_list = $msn->getContactList('BL');
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Mon Mar 14, 2005 12:27 pm    Post subject: Reply with quote

Thought that could be a problem, but this is needed in various places outside the sub(including ext. files), and i dont want to be passing them.

Would making it a non-my non-our strraight out variable work(and not be too dodgy)?
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Mon Mar 14, 2005 12:44 pm    Post subject: Reply with quote

Declare @bl_list outside the sub with our, and in the sub, just (re)set the value of it.
_________________
Current Site (2008) http://www.cuvou.com/
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Mon Mar 14, 2005 1:18 pm    Post subject: Reply with quote

Doesn't seem to work:(
Back to top
..::BIGmouth( )::..
God Like
God Like


Joined: 05 Feb 2004
Posts: 801

Reputation: 44.1Reputation: 44.1Reputation: 44.1Reputation: 44.1

PostPosted: Mon Mar 14, 2005 1:35 pm    Post subject: Reply with quote

Post your code soo we can see what your doing.
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Tue Mar 15, 2005 9:26 am    Post subject: Reply with quote

Code:
our @bl_list;<br /><br />sub sysevents {<br /><br />print "Events!";<br /><br />@bl_list = $msn->getContactList('BL');<br /><br />my @rl_list = $msn->getContactList('RL');<br /><br /><br />foreach my $user (@rl_list){<br /><br />if(-e $floodcheck->{$user}->{unblock_time}) {<br /><br />if(time() > $floodcheck->{$user}->{unblock_time}){<br />$msn->unblockContact($msn);<br />$msn->call("$user","You have been unblocked from dragetBOT, please be more careful next time.");<br />}<br /><br />}<br />}<br /><br /><br />$sysevents->{time} = time();<br /><br />}<br /><br />


Sub is run periodically.

variable @bl_list is used by other subs.
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Tue Mar 15, 2005 11:10 am    Post subject: Reply with quote

First off the RL list is only useful in finding out how many people have added your bot to their contact lists. It has nothing to do with blocking. Second, you're not even using @bl_list - maybe you use it somewhere else. But it looks like you want to go through your list of blocked users and remove the block if enough time has passed. In that case, use the @bl_list, not the @rl_list. Finally, you're not unblocking a contact, you're unblocking the msn object??!! So no wonder the block list never changes. Also note that @bl_list is only updated when you call getContactList( 'BL' ), so only as often as this code runs.

Try:

Code:
our @bl_list;<br /><br />sub sysevents {<br /><br />print "Events!";<br /><br />@bl_list = $msn->getContactList('BL');<br /><br />foreach my $user (@bl_list){<br /><br />if(-e $floodcheck->{$user}->{unblock_time}) {<br /><br />if(time() > $floodcheck->{$user}->{unblock_time}){<br />$msn->unblockContact($user);<br />$msn->call("$user","You have been unblocked from dragetBOT, please be more careful next time.");<br />}<br /><br />}<br />}<br /><br /><br />$sysevents->{time} = time();<br /><br />}
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Wed Mar 16, 2005 10:00 am    Post subject: Reply with quote

Works thanks!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group