mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-29 06:51:12 -05:00
TextArt: rainbow scroll modes.
This commit is contained in:
parent
7c073389a1
commit
4621a29894
@ -1681,9 +1681,9 @@ class TextArt(callbacks.Plugin):
|
|||||||
irc.reply("\x031,8888\x031,8989\x031,9090\x031,9191\x031,9292\x031,9393\x031,9494\x031,9595\x031,9696\x031,9797\x031,9898\x031,9999", prefixNick=False)
|
irc.reply("\x031,8888\x031,8989\x031,9090\x031,9191\x031,9292\x031,9393\x031,9494\x031,9595\x031,9696\x031,9797\x031,9898\x031,9999", prefixNick=False)
|
||||||
codes = wrap(codes)
|
codes = wrap(codes)
|
||||||
|
|
||||||
def rainbow(self, irc, msg, args, optlist, channel):
|
def rainbow(self, irc, msg, args, channel, optlist):
|
||||||
"""[channel] [--delay <float>]
|
"""[channel] [--delay <float>] [--mode <1|2>]
|
||||||
Scroll a rainbow.
|
Scroll a rainbow. Mode 1 squiggle. Mode 2 zig-zag.
|
||||||
"""
|
"""
|
||||||
if not channel:
|
if not channel:
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
@ -1691,11 +1691,22 @@ class TextArt(callbacks.Plugin):
|
|||||||
irc.errorNoCapability('admin')
|
irc.errorNoCapability('admin')
|
||||||
return
|
return
|
||||||
self.stopped[channel] = False
|
self.stopped[channel] = False
|
||||||
|
optlist = dict(optlist)
|
||||||
if 'delay' in optlist:
|
if 'delay' in optlist:
|
||||||
delay = optlist.get('delay')
|
delay = optlist.get('delay')
|
||||||
else:
|
else:
|
||||||
delay = self.registryValue('delay', msg.args[0])
|
delay = self.registryValue('delay', channel)
|
||||||
indent = 10 # How many spaces to indent.
|
if 'mode' in optlist:
|
||||||
|
mode = optlist.get('mode')
|
||||||
|
else:
|
||||||
|
mode = 1
|
||||||
|
if mode > 2 or mode < 1:
|
||||||
|
mode = 1
|
||||||
|
if mode == 1:
|
||||||
|
indent = 10 # How many spaces to indent.
|
||||||
|
else:
|
||||||
|
indent = 0
|
||||||
|
indentIncreasing = True # Whether the indentation is increasing or not.
|
||||||
while True: # Main program loop.
|
while True: # Main program loop.
|
||||||
if self.stopped[channel]:
|
if self.stopped[channel]:
|
||||||
break
|
break
|
||||||
@ -1711,16 +1722,28 @@ class TextArt(callbacks.Plugin):
|
|||||||
if not self.stopped[channel]:
|
if not self.stopped[channel]:
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
irc.reply(line, prefixNick=False)
|
irc.reply(line, prefixNick=False)
|
||||||
if random.randint(0, 1) == 0:
|
if mode == 1 and random.randint(0, 1) == 0:
|
||||||
# Increase the number of spaces:
|
# Increase the number of spaces:
|
||||||
indent = indent + 1
|
indent = indent + 1
|
||||||
if indent > 80:
|
if indent > 60:
|
||||||
indent = 80
|
indent = 60
|
||||||
else:
|
elif mode == 1:
|
||||||
# Decrease the number of spaces:
|
# Decrease the number of spaces:
|
||||||
indent = indent - 1
|
indent = indent - 1
|
||||||
if indent < 0:
|
if indent < 0:
|
||||||
indent = 0
|
indent = 0
|
||||||
rainbow = wrap(rainbow, [optional('channel'), getopts({'delay':'float'})])
|
if mode == 2 and indentIncreasing:
|
||||||
|
# Increase the number of spaces:
|
||||||
|
indent = indent + 1
|
||||||
|
if indent == 60:
|
||||||
|
# Change direction:
|
||||||
|
indentIncreasing = False
|
||||||
|
elif mode == 2:
|
||||||
|
# Decrease the number of spaces:
|
||||||
|
indent = indent - 1
|
||||||
|
if indent == 0:
|
||||||
|
# Change direction:
|
||||||
|
indentIncreasing = True
|
||||||
|
rainbow = wrap(rainbow, [optional('channel'), getopts({'delay':'float', 'mode':'int'})])
|
||||||
|
|
||||||
Class = TextArt
|
Class = TextArt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user