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 

Random Text Grabber [Solved]

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


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Tue Sep 12, 2006 10:51 am    Post subject: Random Text Grabber [Solved] Reply with quote

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
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Sep 12, 2006 2:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Sep 12, 2006 2:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Sep 12, 2006 2:51 pm    Post subject: Reply with quote

@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
View user's profile Send private message
kris
Voice


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Tue Sep 12, 2006 9:50 pm    Post subject: thanks. Reply with quote

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
View user's profile Send private message Visit poster's website
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