| View previous topic :: View next topic |
| Author |
Message |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Tue Sep 12, 2006 10:51 am Post subject: Random Text Grabber [Solved] |
|
|
Basically, it grabs the text from the variable and displays it, its a simple love script.
| Code: |
bind pub -|- `random pub_random
proc pub_random {nick host hand channel text} {
global reply
putquick "PRIVMSG $channel \00306* $nick would like to send $text :[lindex $reply [rand [llength $reply]]]"
}
set reply [list "\"A Box of chocolates\"" "\"a single white rose\"" "\"A pile of dog poo\"" "\"Nothing, Dump them!\"" ] |
The error it comes up with is:
[00:49] Tcl error [pub_random]: wrong # args: should be "rand"[/code]
Last edited by kris on Mon Nov 06, 2006 12:23 am; edited 1 time in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Sep 12, 2006 2:45 pm Post subject: |
|
|
Got any scripts that might've renamed rand?
(hint, search all your scripts for "rename rand") _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Tue Sep 12, 2006 2:47 pm Post subject: |
|
|
You don't need to have the "set reply" outside of the proc, just put it above the putquick. And use this kind of format:
| Code: |
set reply {
{Whatever reply}
{2nd reply}
{Reply three}
}
|
That's what I use anyway, there's more than one way to do random stuff like this. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Sep 12, 2006 2:51 pm Post subject: |
|
|
@rosc:
Actually, using [list ...] to generate lists is preferred to trying to craft your own list structures by hand...
Anyway, the error at hand here is that "rand" seems to have been replaced by a different function/proc that does'nt take a "limit"-value _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Tue Sep 12, 2006 9:50 pm Post subject: thanks. |
|
|
ill have a look, ill see what there is to fix, if their is another one ill remove it, ive made a few different ones, but ill try.
Kris |
|
| Back to top |
|
 |
|