mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2014
Posts: 3
N
Necro Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Dec 2014
Posts: 3
i am trying to set up a script that would take a word bank in a file, randomly picking one, then using in a script. Outcome would be a random word raffle. This is what i have so far. Where monkey is i want it to be from file random. What route should i use? i have found $read(file.txt, n) but how would i embed that to work the way i need on the "on *:text:*monkey*:#:?

#random off
on *:text:*monkey*:#: {
if (%flood) { return }
set -u10 %flood On
msg $chan !kraffle open Monkey 20
.disable #random
}
#random end
---------------------------------------------
Word file would be something like

monkey
house
cake
cookie

Last edited by Necro; 10/12/14 08:04 AM.
Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
Note that the correct forum to ask for scripting help is the script & popups section.

You can use $() to dynamically evaluate the content of the parameter of an event, you can use $read to pick a random line in a file.

Code:
#random off
on *:text:$($+(*,$read(wordsbank.txt,tn),*):#: {
if (%flood) { return }
set -u10 %flood On
msg $chan !kraffle open $mid($matchkey,2,-1) 20
.disable #random
}
#random end


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2014
Posts: 3
N
Necro Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Dec 2014
Posts: 3
Thank you so much. And sorry for using wrong section.


Link Copied to Clipboard