egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Script executes on one bot but not on the other

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
mrNobody
Voice


Joined: 02 Dec 2013
Posts: 14

PostPosted: Thu Dec 19, 2013 9:38 am    Post subject: Script executes on one bot but not on the other Reply with quote

Hi all,

I wrote a very simple script to set a mode to my channels. I have a production bot and a testbot on the same network. The testbot runs the script without any problems, but the production bot doesn't trigger it at all. I checked with .binds that the command is bound, and with .whois that I have the nescesarry flags.

this is the script:

Code:

bind pub (m) !set mcm:set

proc mcm:set {nick host handle chan args} {
   set script [lindex [join $args] 0]
   set what [lindex [join $args] 1]
   if {$what == ""} {
      putserv "NOTICE $nick :Error. No settings specified. Use !set <script> <on|off>"
      return
   } elseif { $what == "on"} {
      set what "+"
      set notice "enabled"
   } else {
      set what "-"
      set notice "disabled"
   }
   channel set $chan $what$script
   puthelp "PRIVMSG $chan :$script $notice"
}


on testbot it runs as it is supposed to.
on productionbot it doesn't even trigger the command.
I'm owner of both bots, the command shows in both .binds commands but it only gets triggered on testbot.
Oh yeah, I also restarted the productionbot, didn't do the trick either.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Dec 19, 2013 12:29 pm    Post subject: Reply with quote

Give this a try.
Code:

bind pub m|m !set mcm:set

proc mcm:set {nick host handle chan text} {
   if {[scan $text {%s%s} script mode] != 2} {
      puthelp "NOTICE $nick :Error, no settings specified. Use !set <script> <on|off>"
   }
   catch {channel get $chan $script} err
   if {$err!=0} {
      puthelp "NOTICE $nick :Error, the $script setting doesn't exist!"
      return
   }
   switch -- [string tolower $mode] {
      "on" {
         if {[channel get $chan $script]} {
            puthelp "NOTICE $nick :Error, the $script setting is already enabled."
         } else {
            channel set $chan +$script
            puthelp "NOTICE $nick :The $script setting has been disabled."
         }
      }
      "off" {
         if {![channel get $chan $script]} {
            puthelp "NOTICE $nick :Error, the $script setting is already disabled."
         } else {
            channel set $chan -$script
            puthelp "NOTICE $nick :The $script setting has been disabled."
         }         
      }
   }
}

Haven't tested so load it on test bot and see if it works. Reply back if you got any issues.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
mrNobody
Voice


Joined: 02 Dec 2013
Posts: 14

PostPosted: Thu Dec 19, 2013 12:37 pm    Post subject: Reply with quote

it returns error code 1

//edit:
If I remove the part that catches the error code it works on testbot

//edit2:
If I load it on the production bot, just like my own code, it doesn't execute.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Dec 20, 2013 1:30 am    Post subject: Reply with quote

What versions of eggdrop and TCL you got there?
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
mrNobody
Voice


Joined: 02 Dec 2013
Posts: 14

PostPosted: Fri Dec 20, 2013 5:33 am    Post subject: Reply with quote

eggdrop 1.6.21, tcl version 8.5.11
It runs on a raspberry pi with debian linux. Both bots run on the same machine with virtually the same config file.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Dec 20, 2013 7:45 am    Post subject: Reply with quote

Where do you see that error code 1?
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
mrNobody
Voice


Joined: 02 Dec 2013
Posts: 14

PostPosted: Fri Dec 20, 2013 8:00 am    Post subject: Reply with quote

I made it putlog $err
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Dec 20, 2013 10:03 am    Post subject: Reply with quote

And you don't get any notice from the bot with that error?
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
mrNobody
Voice


Joined: 02 Dec 2013
Posts: 14

PostPosted: Fri Dec 20, 2013 2:25 pm    Post subject: Reply with quote

no, the bot stays otherwise silent
Back to top
View user's profile Send private message
mrNobody
Voice


Joined: 02 Dec 2013
Posts: 14

PostPosted: Sun Dec 22, 2013 9:24 am    Post subject: Reply with quote

I found what was causing this problem, apparently my production bot had the wrong hostname for my user, so it didn't trigger the script. updated the hostname and now it works as it should, thanks for your help though!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot 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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber