| View previous topic :: View next topic |
| Author |
Message |
dokueki Voice
Joined: 28 Apr 2007 Posts: 31 Location: Bat Yam, Israel
|
Posted: Mon May 07, 2007 10:02 am Post subject: Quick Linking Again // Other Method This Time |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon May 07, 2007 10:31 am Post subject: |
|
|
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 |
|
 |
dokueki Voice
Joined: 28 Apr 2007 Posts: 31 Location: Bat Yam, Israel
|
Posted: Mon May 07, 2007 11:04 am Post subject: |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon May 07, 2007 11:11 am Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon May 07, 2007 11:13 am Post subject: |
|
|
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 |
|
 |
dokueki Voice
Joined: 28 Apr 2007 Posts: 31 Location: Bat Yam, Israel
|
Posted: Mon May 07, 2007 12:34 pm Post subject: |
|
|
| Thanks, I replaced "args" with "text" and it worked. Sorry for all the trouble! |
|
| Back to top |
|
 |
|