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.

My First Script - Too many arguements

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

My First Script - Too many arguements

Post by Weirdo »

Hi

Decided today would learn tcl. Make a simple script that when !staturl was entered in any of its channels, would display the livestats url. I got it to the point where the only error i get is this.

[22:05:46] <Minako> [22:05] Tcl error [livestat_announce]: called "livestat_announce" with too many arguments

But i really dont have a clue what is going wrong

This is the script itself

set livestaturl “http://seb01.dns2go.com:4000

bind pubm - !staturl livestat_announce

proc livestat_announce {nick chan text} {
set $chan #cometanime
set $text http://seb01.dns2go.com:4000
putnotc $nick $text
}

Kinda crappy i know. But could you help me with it?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Check tcl-commands.doc for the number of arguments and the order they're supposed to be in. You can't just type words there and have eggdrop understand what you mean :)
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

(6)  PUBM (stackable)
         bind pubm <flags> <mask> <proc>
         procname <nick> <user@host> <handle> <channel> <text>

         Description: just like MSGM, except it's triggered by things said
           on a channel instead of things /msg'd to the bot. The mask is
           matched against the channel name followed by the text and can
           contain wildcards.
         Module: irc

Is that right?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Yah it's right. For future reference you may find it faster to just try it than ask though hehe.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Re-read tcl-commands.doc

There is a differance between the PUBM and PUB binds.

Looking at your script, you have not yet grasped the differance.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

    (4)  PUB
         bind pub <flags> <command> <proc>
         procname <nick> <user@host> <handle> <channel> <text>

         Description: used for commands given on a channel. The first word
           becomes the command and everything else is the text argument.
         Module: irc

So this one might be more suited for !staturl or commands given in channel rather than pubm?

The only difference i see in the syntax is the <command> replacing the <mask> used in pubm

Still not sure if i am grasping this correctly...
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

In PUBM, it states, it is like MSGM.
(5) MSGM (stackable)
bind msgm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <text>

Description: matches the entire line of text from a /msg with the
mask. This is useful for binding Tcl procs to words or phrases
spoken anywhere within a line of text.
Module: server
Thus, PUBM is the channel triggered version.

This bind allows you to match whole lines, rather than just the first word, based on a trigger.

IE, take this line of incoming text
Visit http://www.egghelp.org/ for help with eggdrop setup
If you use a mask of "* http://*", in PUBM or MSGM, it will trigger on any line (based on the bind, and where the message is destined) that has a URL, begining with http://.

Whereas PUB and MSG binds, expect a ketword, that is the first word in a line of text.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Ah, i get it. So for this particular script, running where !staturl is placed as the first word on a line, PUB would be much easier. And i set it to look for !staturl as the command?

Will the script automatically look for this in all channels the bot is on? Kinda confused where you put the bit where you tell it to send the notice to the user which says this command. Do you put it in a separate procedure which is associated to the bind?
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

Hey

Well i did some work on it. Kinda improved the script so it works now... well, it doesnt produce arguement errors and triggers those errors on production of !staturl

[18:26:39] <Minako> [18:26] Tcl error [pub:livestat]: missing "

I get this from the bot. Looks like a syntax error, but i cant find where the missing " goes
#Provides the !staturl public event
bind pub - “!staturl” pub:livestat
proc pub:livestat {nick host hand chan livestaturl } {
putcmdlog "<$nick@$chan> !$hand! staturl"
puthelp "PRIVMSG $chan :The Livestats URL is $livestaturl”
}

putlog "\Livestats V0.1 by Weirdo"
Thats the script as is, cant find out where the missing " is at all. Any ideas people?
User avatar
slennox
Owner
Posts: 593
Joined: Sat Sep 22, 2001 8:00 pm
Contact:

Post by slennox »

Is it just my eyes playing tricks on me, or are you using two different types of quotation marks?
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

oh yeah....

my keyboard produces ", dont know where the slanted ones came from

Hmmm, edit them all into the same type. And i get the puthelp, wrong number of Arguements, and putcmdlog, wrong number of arguements.

Damn frustrating. What else is wrong?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

My sugestion would be to use a different editor.

Do a search on the net for "pfe32".

It's a good, free editor, that can save as usix files.

WHile it may not be developed any more, it works without fail.
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

i using notepad now, fixed the problem nicely.

Damn ", those curly ones suck ass
Locked