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 

Quick Linking Again // Other Method This Time

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


Joined: 28 Apr 2007
Posts: 31
Location: Bat Yam, Israel

PostPosted: Mon May 07, 2007 10:02 am    Post subject: Quick Linking Again // Other Method This Time Reply with quote

Well, the other script was giving me trouble if I tried multiplying it for several links, so I thought I'd just stop going the SDK way and make the script for myself, as no one will need it from me anyways. So the scripts is as such:
Code:
bind pub - "!xpro" spidey:xpro_link

proc spidey:xpro_link { nick host hand chan args } {

   set params [split $args]
   set action [lindex $params 0]
   set sa [lindex $params 1]

   putserv "NOTICE $nick :1. $action 2. $sa"
    if { $action == "" } {
      putserv "PRIVMSG $chan :http://xpro.zeeblo.com (Requested by $nick)"
   } elseif { $action != "" && $sa == "" } {
      putserv "NOTICE $nick :Not enough parameters."
   } elseif { $action == "topic"} {
      putserv "PRIVMSG $chan :http://xpro.zeeblo.com/index.php?topic=$sa (Requested by $nick)"
   } elseif { $action == "forum"} {
      putserv "PRIVMSG $chan :http://xpro.zeeblo.com/index.php?board=$sa (Requested by $nick)"
   } elseif { $action == "user"} {
      putserv "PRIVMSG $chan :http://xpro.zeeblo.com/index.php?action=profile;u=$sa (Requested by $nick)"
   } elseif { $action == "action"} {
      putserv "PRIVMSG $chan :http://xpro.zeeblo.com/index.php?$sa (Requested by $nick)"
   }
   return 0
}

putlog "xproDesigns Links 1.0 by Hen Asraf: Loaded"

When outputting the notice at start to debug what was going on with the arguments, I noticed the first argument begins with { and the second ends with } so it outputted "1. {foo 2. bar}". Is there a way to stop this from happening and return everything without the braces?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 07, 2007 10:31 am    Post subject: Reply with quote

Yes, don't use "args" as a parameter name (anything else will do, just not "args")
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
dokueki
Voice


Joined: 28 Apr 2007
Posts: 31
Location: Bat Yam, Israel

PostPosted: Mon May 07, 2007 11:04 am    Post subject: Reply with quote

I tried that. When I did, it would give me this error:
Code:
[04:53:40 pm] <Venom> [11:53] Tcl error [spidey:xpro_link]: wrong # args: should be "spidey:xpro_link nick host hand chan action sa"

And even if I fixed that, would it work if I put less parameters than necessary?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon May 07, 2007 11:11 am    Post subject: Reply with quote

Why on earth would you replace "args" with multiple arguments ("action" and "sa")? The number of arguments in your proc-definition must match the number of arguments used when the binding triggers (with pub-bindings, this would be <nickname> <host> <handle> <channel> <text>).

The text ppl write in the channel will always use one argument with pub-bindings, it is up to you as a coder to gather the desired data from it...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon May 07, 2007 11:13 am    Post subject: Reply with quote

He told you to rename 'args' to anything else (1 word) and you replaced it with 'action sa' ... How about just 'text'?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
dokueki
Voice


Joined: 28 Apr 2007
Posts: 31
Location: Bat Yam, Israel

PostPosted: Mon May 07, 2007 12:34 pm    Post subject: Reply with quote

Thanks, I replaced "args" with "text" and it worked. Sorry for all the trouble!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
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