This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[Solved] Need some help again :\

Help for those learning Tcl or writing their own scripts.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Yes... so why do you then force your bot to leave if there's more than 5 members?
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

Well... Another error :P

Code: Select all

[17:04] Tcl error in file 'eggdrop.conf':
[17:04] wrong # args: should be "proc name args body"
    while executing
"proc invites:joinmsg {nick uhost hand chan} {
 global requirement
 set nickonchan [llength [chanlist $chan]]
  if {$nickonchan < $requirement} {
   p..."
    (file "scripts/invite1.tcl" line 20)
    invoked from within
"source scripts/invite1.tcl"
    (file "eggdrop.conf" line 1353)
[17:04] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Red_Rooste5 @ bluebird.tx-shells.com ~/eggdrop $
Code:

Code: Select all

bind raw - INVITE invites:join
 proc invites:join {from key arg} {
 set chan [string range [lindex [split $arg] 1] 1 end]
 set chans [llength [split [channels]]]
 set nick [lindex [split $from !] 0]
 if {$chans == 30} {
  putquick "NOTICE $nick :This bot is currently full, searching for other bots."
  putquick "PRIVMSG #boombot :join $chan"
  utimer 10 [list invites:joinmsg $chan $nick]
  return
 } if {$chans < 30} {
  channel add $chan
  putquick "PRIVMSG $chan :\00302BoomBot version 1.9 by \00307Red_Rooste5"
  return
  }
}

set requirement 5

proc invites:joinmsg {nick uhost hand chan} {
 global requirement
 set nickonchan [llength [chanlist $chan]]
  if {$nickonchan < $requirement} {
   putquick "PART $chan :You need atleast 5 users to have this bot in your chan$
   channel remove $chan
  } elseif {[onchan \[De\]BoomBot $chan]} {
  putlog "OMG \[De\]BoomBot is on $chan"
  putquick "PART $chan You already have a BoomBot in your chan."
  channel remove $chan
  return
 } elseif {$nickonchan =< $requirement} && [string equal -nocase $::botnick $nick]} {
  putquick "PRIVMSG $chan :\00302BoomBot v1.9 by \00307Red_Rooste5"
  return
 }
}
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Balance your braces.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

In addition to what Sir_Fz said, this line is faulty:

Code: Select all

} elseif {$nickonchan =< $requirement} && [string equal -nocase $::botnick $nick]} {
Simply put, there's one } too many in there, remove it. Which one should be obvious.
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

Got the bot on...

Code: Select all

[19:46] Tcl error [invites:join]: wrong # args: no expression after "if" argument
When I try to invite it.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Assuming you hav'nt altered invites:join since last posting it, I'd say the error is here:

Code: Select all

 } if {$chans < 30} {
This should really be either one of these:

Code: Select all

 } elseif {$chans < 30} {

Code: Select all

 }
 if {$chans < 30} {
Looking up the manual-page for if might be a good idea
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

Yeah, that worked, thank you ;)
But it still doesn't part when the channel has 4 people in it :\
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Yet another logic-error..
Considder this piece of your code:

Code: Select all

 if {$chans == 30} {
  putquick "NOTICE $nick :This bot is currently full, searching for other bots."
  putquick "PRIVMSG #boombot :join $chan"
  utimer 10 [list invites:joinmsg $chan $nick]
  return
 } elseif {$chans < 30} {
  channel add $chan
  putquick "PRIVMSG $chan :\00302BoomBot version 1.9 by \00307Red_Rooste5"
  return
 }
Now, under which conditions would invites:joinmsg be called?

Edit: Tiny fix to actually produce runnable code, as suggested in my previous post...
Last edited by nml375 on Tue Dec 12, 2006 3:15 pm, edited 1 time in total.
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

If the bot is on 30 channels :\
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Yes.
Under which conditions would your bot join a channel when being invited to one?
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

If the bot is on less than 30 channels...?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Yes.
What is the sole purpose of calling invites:joinmsg?
And when would it actually be useful to call invites:joinmsg?
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

I actually have no idea :\
But I didn't know what else to do :\
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

You're saying you don't know what your own code should do?
NML_375
R
Red_Rooste5
Voice
Posts: 37
Joined: Sat Oct 21, 2006 7:43 am

Post by Red_Rooste5 »

What I'm saying is that I dunno why I am hopin to invite:joinmsg
I think it's got with something on the first script I made.
Post Reply