source: tags/release-0-0-4/randomword.tcl @ 1143

Revision 2, 2.5 KB checked in by jamesoff, 9 years ago (diff)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1# random word generator for bex
2
3source "scripts/randomwordList.tcl"
4
5bind pub - "!beckyword" pubm_beckyword
6bind pub - "!beckywordcount" pubm_beckywordcount
7bind pub - "!kitword" pubm_kitword
8bind pub - "!ick" pubm_ick
9bind pub - "!rosieword" pubm_rosieword
10#bind pub - "!taunt" pubm_taunt
11bind pub - "!bhar" pubm_letters
12
13proc pubm_beckyword {nick host handle channel text} {
14  global randomPrefixes randomFirstParts randomMiddleParts randomEndParts
15  set prefix ""
16  if [rand 2] {
17    set prefix [pickRandom $randomPrefixes]
18  }
19  bMotionDoAction $channel $nick "$prefix[pickRandom $randomFirstParts][pickRandom $randomMiddleParts][pickRandom $randomEndParts]"
20}
21
22proc pubm_beckywordcount {nick host handle channel text} {
23  global randomFirstParts randomMiddleParts randomEndParts randomPrefixes
24  set bl "prefixes: [llength $randomPrefixes] first parts: [llength $randomFirstParts] second parts: [llength $randomMiddleParts] last parts: [llength $randomEndParts]"
25
26  set total [expr [llength $randomFirstParts] * [llength $randomMiddleParts] * [llength $randomEndParts] * [expr [llength $randomPrefixes] + 1]]
27  set bl "$bl total: $total"
28  puthelp "PRIVMSG $channel :$bl"
29}
30
31proc pubm_kitword {nick host handle channel text} {
32  global randomKitWords
33  bMotionDoAction $channel $nick "[pickRandom $randomKitWords]"
34}
35
36
37
38proc pubm_rosieword {nick host handle channel text} {
39  global randomRosieFirstParts randomRosieSecondParts
40  set first [pickRandom $randomRosieFirstParts]
41  set line ""
42
43  set mode [rand 3]
44 
45  if {$mode == 0} {
46    #<something><something>
47    set second $first
48    while {$second == $first} {
49      set second [pickRandom $randomRosieSecondParts]
50    }
51    set line "$first$second"
52  }
53
54  if {$mode == 1} {
55    #<something> <something>
56    set second $first
57    while {$second == $first} {
58      set second [pickRandom $randomRosieSecondParts]
59    }
60    set line "$first $second"
61  }
62
63  if {$mode == 2} {
64    putlog "mode = 2 bof"
65    #<something>^n<something>
66    set count [rand 10]
67    set count [expr $count + 1]
68    set line $first
69    while {$count > 0} {
70      incr count -1
71      set line "$line $first"
72    }
73    set second [pickRandom $randomRosieSecondParts]
74    set line "$line $second"
75  }
76  bMotionDoAction $channel $nick "$line"
77}
78
79proc pubm_letters {nick host handle channel text} {
80  set randomChar "!£$%^&*@#~€"
81
82  set randomChars [split $randomChar {}]
83
84  set length [rand 8]
85  set length [expr $length + 5]
86
87  set line ""
88
89  while {$length >= 0} {
90    incr length -1
91
92    set line "$line[pickRandom $randomChars]"
93  }
94
95  bMotionDoAction $channel "" $line
96}
Note: See TracBrowser for help on using the repository browser.