User Control Panel
Advertisements

HELP US, HELP YOU!

Bunch of errors
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Bot Depot Forum Index -> General Programming Questions
View unanswered posts
Author Message
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Fri Jul 08, 2005 8:30 pm    Post subject: Bunch of errors Reply with quote

Code:
use Net::OSCAR qw(:standard);

        my $screenname = "Bot";
        my $password = "pass";
        my $master = "Me";


        sub im_in {
                my($oscar, $client, $msg, $is_away) = @_;
        $msg =~ s/<(.|\n)+?>//g;
                print "[AWAY] " if $is_away;
                print "$client: $msg\n";

   if ($msg eq "Hi") {
        $reply = "Hello $client";
} elsif ($msg eq "Hello") {
   $reply = "Hi $client";
} elsif ($msg eq "How are you") {
   $reply = "I am fine, thanks for asking";
} elsif ($msg eq "Who made you") {
   $reply = "$master made me from scratch";
} elsif ($msg eq "bot.pl") {
   open (BOT,"./bot.pl");
   @bot= <BOT>;
   close (BOT);
   $reply = @bot;
} elsif ($msg eq "Stealth on") {
   $oscar->set_stealth (is_stealth);
} elsif ($msg eq "Stealth off) {
   $oscar->set_stealth();
} elsif ($msg eq info on (.*)) {
   $infoperson = $1;
   $oscar->get_info ($infoperson);
} else {
        $reply = "Unknown reply";
}

        print "$screenname: $reply\n";
        $oscar->send_typing_status ($client,TYPINGSTATUS_STARTED);
        sleep(3);
        $oscar->send_im ($client,$reply);
        $oscar->send_typing_status ($client,TYPINGSTATUS_FINISHED);
        }
    sub buddy_in {
        my($oscar, $person, $group, $data) = @_;
        print "\n\n$person ($group) just signed in\n\n";

    }
    sub buddy_out {
        my($oscar, $person, $group) = @_;
        print "\n\n$person ($group) just signed out\n\n";
    }
    sub signon_done {
        my($oscar) = @_;
        my $buddyprofile = "$screenname was made from scratch by $master";
        print "$buddyprofile";
        $oscar->set_info ($buddyprofile);
   $oscar->set_visibility (VISMODE_DENYSOME);
        $oscar->commit_buddylist();
        print "\n\n$screenname has finished signing into AIM\n\n";
    }
    sub buddlist_error {
        my($oscar,$error,$what) = @_;
        print "$error $what";
    }
    sub buddylist_ok {
        my($oscar) = @_;
        print "Buddylist changes have been successfully commited";
    }
    sub evil{
   my($oscar,$newlevel,$warner) = @_;
   if ($warner ne "") {
   print "$warner has warned us to $newlevel";
   print "We are now warning $warner back";
   $oscar->evil ($warner);
   print "We are now adding $warner to the deny list";
   $oscar->add_deny ($warner);
   $oscar->commit_buddylist();
   print "Currently, these are the people on the deny list:";
   $oscar->get_denylist();
   }
   else {
   print "We have been warned anonymously";
   }
}
    sub buddy_info {
   my($oscar,$screenname,$data) = @_;
   print "$screenname \n $data";
   }
         
    $oscar = Net::OSCAR->new(capabilities => [qw(extended_status buddy_icons file_transfer file_sharing typing_status)]);

    $oscar->set_callback_im_in(\&im_in);
    $oscar->set_callback_signon_done(\&signon_done);
    $oscar->set_callback_buddy_in(\&buddy_in);
    $oscar->set_callback_buddy_out(\&buddy_out);
    $oscar->set_callback_buddylist_error(\&buddylist_error);
    $oscar->set_callback_buddylist_ok(\&buddylist_ok);
#    $oscar->set_callback_new_buddy_icon(\&new_buddy_icon);
#    $oscar->set_callback_buddy_icon_download(\&buddy_icon_downloaded);
#    $oscar->set_callback_typing_status(\&typing_status);
#    $oscar->set_callback_im_ok(\&im_ok);
    $oscar->set_callback_buddy_info(\&buddy_info);
#    $oscar->set_callback_admin_error(\&admin_error);
#    $oscar->set_callback_admin_ok(\&admin_ok);
#    $oscar->set_callback_buddy_icon_uploaded(\&buddy_icon_uploaded);
#    $oscar->set_callback_stealth_changed(\&stealth_changed);
#    $oscar->set_callback_extended_status(\&extended_status);
    $oscar->set_callback_evil(\&evil);
#    $oscar->set_callback_connection_changed(\&connection_changed);
#    $oscar->set_callback_chat_buddy_in(\&chat_buddy_in);
#    $oscar->set_callback_chat_buddy_out(\&chat_buddy_out);
#    $oscar->set_callback_chat_im_in(\&chat_im_in);
#    $oscar->set_callback_chat_invite(\&chat_invite);
#    $oscar->set_callback_chat_joined(\&chat_joined);
#    $oscar->set_callback_chat_closed(\&chat_closed);
#    $oscar->set_callback_auth_challenge(\&auth_challenge);
#    $oscar->set_callback_error(\&error);
#    $oscar->set_callback_rate_alert(\&rate_alert);
#    $oscar->set_callback_snac_unknown(\&snac_unknown);


    #Sign into AIM
    $oscar->signon($screenname, $password);
        while(1) {
                $oscar->do_one_loop();
        }


Error:

Quote:
Bareword found where operator expected at bot.pl line 35, near "$reply = "Unknow
n"
(Might be a runaway multi-line "" string starting on line 29)
(Missing operator before Unknown?)
Scalar found where operator expected at bot.pl line 38, near "print "$screenname
"
(Might be a runaway multi-line "" string starting on line 35)
(Do you need to predeclare print?)
Backslash found where operator expected at bot.pl line 38, near "$reply\"
(Missing operator before \?)
String found where operator expected at bot.pl line 46, near "print ""
(Might be a runaway multi-line "" string starting on line 3Cool
(Missing semicolon on previous line?)
Backslash found where operator expected at bot.pl line 46, near "print "\"
(Do you need to predeclare print?)
Backslash found where operator expected at bot.pl line 46, near "n\"
Bareword found where operator expected at bot.pl line 46, near ") just"
(Missing operator before just?)
Backslash found where operator expected at bot.pl line 46, near "in\"
Backslash found where operator expected at bot.pl line 46, near "n\"
String found where operator expected at bot.pl line 51, near "print ""
(Might be a runaway multi-line "" string starting on line 46)
(Missing semicolon on previous line?)
Backslash found where operator expected at bot.pl line 51, near "print "\"
(Do you need to predeclare print?)
Backslash found where operator expected at bot.pl line 51, near "n\"
Bareword found where operator expected at bot.pl line 51, near ") just"
(Missing operator before just?)
Backslash found where operator expected at bot.pl line 51, near "out\"
Backslash found where operator expected at bot.pl line 51, near "n\"
String found where operator expected at bot.pl line 55, near "my $buddyprofile =
""
(Might be a runaway multi-line "" string starting on line 51)
(Missing semicolon on previous line?)
Scalar found where operator expected at bot.pl line 55, near "my $buddyprofile =
"$screenname"
(Do you need to predeclare my?)
Bareword found where operator expected at bot.pl line 55, near "$screenname was"

(Missing operator before was?)
String found where operator expected at bot.pl line 56, near "print ""
(Might be a runaway multi-line "" string starting on line 55)
(Missing semicolon on previous line?)
Scalar found where operator expected at bot.pl line 56, near "print "$buddyprofi
le"
(Do you need to predeclare print?)
String found where operator expected at bot.pl line 60, near "print ""
(Might be a runaway multi-line "" string starting on line 56)
(Missing semicolon on previous line?)
Backslash found where operator expected at bot.pl line 60, near "print "\"
(Do you need to predeclare print?)
Backslash found where operator expected at bot.pl line 60, near "n\"
Backslash found where operator expected at bot.pl line 60, near "AIM\"
Backslash found where operator expected at bot.pl line 60, near "n\"
String found where operator expected at bot.pl line 64, near "print ""
(Might be a runaway multi-line "" string starting on line 60)
(Missing semicolon on previous line?)
Scalar found where operator expected at bot.pl line 64, near "print "$error"
(Do you need to predeclare print?)
Scalar found where operator expected at bot.pl line 64, near "$error $what"
(Missing operator before $what?)
String found where operator expected at bot.pl line 68, near "print ""
(Might be a runaway multi-line "" string starting on line 64)
(Missing semicolon on previous line?)
Bareword found where operator expected at bot.pl line 68, near "print "Buddylist
"
(Do you need to predeclare print?)
String found where operator expected at bot.pl line 73, near "print ""
(Might be a runaway multi-line "" string starting on line 72)
(Missing semicolon on previous line?)
Scalar found where operator expected at bot.pl line 73, near "print "$warner"
(Do you need to predeclare print?)
Bareword found where operator expected at bot.pl line 73, near "$warner has"
(Missing operator before has?)
String found where operator expected at bot.pl line 74, near "print ""
(Might be a runaway multi-line "" string starting on line 73)
(Missing semicolon on previous line?)
Bareword found where operator expected at bot.pl line 74, near "print "We"
(Do you need to predeclare print?)
Bareword found where operator expected at bot.pl line 74, near "$warner back"
(Missing operator before back?)
String found where operator expected at bot.pl line 76, near "print ""
(Might be a runaway multi-line "" string starting on line 74)
(Missing semicolon on previous line?)
Bareword found where operator expected at bot.pl line 76, near "print "We"
(Do you need to predeclare print?)
Bareword found where operator expected at bot.pl line 76, near "$warner to"
(Missing operator before to?)
Bareword found where operator expected at bot.pl line 79, near "print "Currently
"
(Might be a runaway multi-line "" string starting on line 76)
(Do you need to predeclare print?)
Bareword found where operator expected at bot.pl line 83, near "print "We"
(Might be a runaway multi-line "" string starting on line 79)
(Do you need to predeclare print?)
String found where operator expected at bot.pl line 88, near "print ""
(Might be a runaway multi-line "" string starting on line 83)
(Missing semicolon on previous line?)
Scalar found where operator expected at bot.pl line 88, near "print "$screenname
"
(Do you need to predeclare print?)
Backslash found where operator expected at bot.pl line 88, near "$screenname \"
(Missing operator before \?)
String found where operator expected at bot.pl line 88, at end of line
(Missing semicolon on previous line?)
syntax error at bot.pl line 35, near "$reply = "Unknown reply"
Can't find string terminator '"' anywhere before EOF at bot.pl line 88.
Press any key to continue . . .


I tried to debug it, but it didn't work.
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Fri Jul 08, 2005 10:39 pm    Post subject: Reply with quote

Most of those are warnings (and BIG warnings too, ones that should be taken care of).

The one that really did it in for your bot was right here though:

Code:
syntax error at bot.pl line 35, near "$reply = "Unknown reply"
Can't find string terminator '"' anywhere before EOF at bot.pl line 88.


Take care of that, run the code again, if it finds another fatal error (hint: the fatal ones are usually the ones right at the end, they kill your code so that's the logical place to look for them Razz).

And continue.

Edit
Just cuz I was bored I decided I'd help ya a bit:

Code:
} elsif ($msg eq info on (.*)) {
   $infoperson = $1;
   $oscar->get_info ($infoperson);
} else {
        $reply = "Unknown reply";
}


Code:
elsif ($msg eq info on (.*?)) {


Bad syntax, missing quotes, and (.*?) is regexp.

Code:
elsif ($msg =~ /info on (.*?)/i) {

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Fri Jul 08, 2005 10:45 pm    Post subject: Reply with quote

I had no clue how to fix the print things at the top, so I started by looking at the bottom (the one you posted). Originally, I had it just saying "Unknown" so I had an error saying something about only having one word. So I changed it to "Unknown Reply". But now, it says I don't have a string terminator. I checked it over 5 times, and I am possitive I have quotes and a semicolon there. I even tried adding "my" in front of the variable, but it gave me the same error. Finally, I downloaded a perl code notepad to see if it would help. I got nothing from it. I have no clue what to do. That is why I posted here.
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Fri Jul 08, 2005 11:19 pm    Post subject: Reply with quote

Those syntax highlighters are useful though. Usually your code should be all bright and colorful, but when all your code ends up being all one color, look up where the color started at and that's probably the error. Smile
_________________
Current Site (2008) http://www.cuvou.com/
Back to top
alienz
Almost An Agent
Almost An Agent


Joined: 22 Mar 2004
Posts: 1436
Location: Mars
Reputation: 55.7

PostPosted: Sat Jul 09, 2005 12:42 am    Post subject: Reply with quote

elsif ($msg eq "Stealth off) {

Is the first error in the code.

Missing a quote and it's the first one just before your $reply = "Unknown reply"; . Fix this and many of the others will probably go away.

Your code is riddled with syntax errors.

_________________
Check out Botworld! A dev resource for things bot.
Downloads, articles, news, fourm and more.
http://botworld.marzopolis.com
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Sat Jul 09, 2005 12:44 pm    Post subject: Reply with quote

Before you replied Alienz, I tried switching the reply system to something based on the trigger module (don't worry, I have the other reply system saved). It says:
Quote:
Missing right curly or square bracket at bot.pl line 128, at end of line
syntax error at bot.pl line 128, at EOF
Execution of bot.pl aborted due to compilation errors.
Press any key to continue . . .


I assumed that the missing sign would be in the on_im sub since that is the only one I've been editing. So I started counting the brackets in there. And I wasn't missing any. Then I looked at the other subs, they all had them. Then I looked at line 128, and it had everything. NOTE: This was done in Notepad since my perl editor is no good for that. So I might have missed something. Here it is:



Code:
sub im_in {
                my($oscar, $client, $msg, $is_away) = @_;
        $msg =~ s/<(.|\n)+?>//g;
                print "[AWAY] " if $is_away;
                print "$client: $msg\n";

   if( $msg eq '' ) {

open (REPLY, "./reply.txt");
@reply = <REPLY>;
close (REPLY);
   
foreach my $line (@reply){}
      my ($first, $last) = split( /:/, $line );
      if( $msg =~ /$first/i )
      {
         if( $last =~ /^service:(.*)$/i )
         {
            my $service_string = $1;
            $service_string =~ s/##MESSAGE##/$msg/g;

            my $reply = get( $service_string );
            
         }
         else
         {
            my @last = split( /\|/, $last );
            $reply [ int rand scalar @last ];
         }
      }

        print "$screenname: $reply\n";
        $oscar->send_typing_status ($client,TYPINGSTATUS_STARTED);
        sleep(3);
        $oscar->send_im ($client,$reply);
        $oscar->send_typing_status ($client,TYPINGSTATUS_FINISHED);
        }
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Sat Jul 09, 2005 1:24 pm    Post subject: Reply with quote

If you INDENT then it should be easier to work it out. You were missing one near the end:

Code:

sub im_in
{
        my($oscar, $client, $msg, $is_away) = @_;
        $msg =~ s/<(.|\n)+?>//g;
             print "[AWAY] " if $is_away;
             print "$client: $msg\n";
        if ($msg eq '')
        {
              open (REPLY, "./reply.txt");
              @reply = <REPLY>;
              close (REPLY);
              foreach my $line (@reply)
              {
                 my ($first, $last) = split( /:/, $line );
                  if( $msg =~ /$first/i )
                  {
                      if( $last =~ /^service:(.*)$/i )
                      {
                         my $service_string = $1;
                         $service_string =~ s/##MESSAGE##/$msg/g;
                         my $reply = get( $service_string );
                      }
                      else
                      {
                      my @last = split( /\|/, $last );
                      $reply [ int rand scalar @last ];
                      }
                  }
               }
      }
      print "$screenname: $reply\n";
        $oscar->send_typing_status ($client,TYPINGSTATUS_STARTED);
        sleep(3);
        $oscar->send_im ($client,$reply);
        $oscar->send_typing_status ($client,TYPINGSTATUS_FINISHED);
}


Just a note: I indent with tabs, as it's more efficient, and is easier to change about, but I used spaces here, as phpBB doesn't count tabs.

Also, I moved one bracket around, for the foreach, so that it will work as it's meant to.

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Sat Jul 09, 2005 1:38 pm    Post subject: Reply with quote

Now it just sends a blank IM. I checked the DOS window, and it is also printing a blank im.
Back to top
alienz
Almost An Agent
Almost An Agent


Joined: 22 Mar 2004
Posts: 1436
Location: Mars
Reputation: 55.7

PostPosted: Sat Jul 09, 2005 3:41 pm    Post subject: Reply with quote

You'd save yourself alot of trouble if you used an editor with syntax highlighting or syntax checking. There are plenty of free ones out there that do that. Just about every problem I've seen you have is because you are not using proper syntax in your code.
_________________
Check out Botworld! A dev resource for things bot.
Downloads, articles, news, fourm and more.
http://botworld.marzopolis.com
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Sat Jul 09, 2005 5:41 pm    Post subject: Reply with quote

I tried to find one, but the one I have isn't that good. Can you recomend a good one that is FREE?
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Sat Jul 09, 2005 6:29 pm    Post subject: Reply with quote

CPad (made by Cer!)
Pspad

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Sun Jul 10, 2005 3:22 pm    Post subject: Reply with quote

I tried both of them, and from what I can tell, it isn't showing any errors (even though it is probably loaded with them)
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Sun Jul 10, 2005 3:36 pm    Post subject: Reply with quote

You will get a more positive response (and this is in response to one of your other posts as well as this problem) if you SHOW what you have tried. Also when debugging never worry about anything but the first error you get. Until you fix it, there is no telling what other errors the same mistake is causeing. So in this case once you got the help to fix stealth you should have had a much smaller set of errors to work with. Continue working with the first error. BTW the actual error will normaly be on the same line OR a line above it. So if you don't find trouble on that line then look up farther until you do. Also commenting out the line it gives you might lead you to the correct line. If you want to continue getting help (and it looks like lots of people are showing up to help agian) then its best to include a peice of code with maybe ten lines above and including the line the error is reported on AND what you have tried. Remember what causes each error becuase that will significantly help you the next time. We have all gotten these errors oursleves and spent time tracking them down and learning there causes. We understand that you are learning perl, we have all been there, we don't mind helping, but we don't want to do your work for you. So just pay attention and learn from your previous mistakes and all will go well. This is for any new person, you are just the one brave enough to keep posting Wink Best of luck and lets see if we can't help you get your code running!
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Sun Jul 10, 2005 3:37 pm    Post subject: Reply with quote

No, it isn't showing an error, because I fixed your syntaxes. Now you just need to go through and work out what you want it to do, so that it sends the message.

The if ($msg eq '') isn't helping, either.

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Sun Jul 10, 2005 3:45 pm    Post subject: Reply with quote

Well, I tried just editing the trigger module. I guess I'm going to have to try and make some more changes.


Would puting a (.*) in there do any good. I can't test it right now.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> General Programming Questions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 



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