I didn't originally add a speed setting to the ScareText admittedly but it wouldn't be hard to add if you wanted. To just slow it down, all you need to do is to change the renpy.redraw(self, 0) in the render function to be something like renpy.redraw(self, 1./30) or something. The '0' tells renpy to redraw this element every frame, so if you have a high frame rate, it'll update very quickly. Putting a fraction there tells it to wait until [fraction] has passed.
You can't really tell it to every 5 frames sadly because, if the frame rate is high, 5 frames might not be a lot anyway. So what you really want is a rate. You can play around with what speed you want but you can try .1 or .05 if you want. Or if you just want division, just do 1./12 for a twelth of a second (I recommend adding the '.' because it tells python to do floating point division instead of integer).
For adding it as a parameter though, you can add that by doing something like.
def scare_tag(tag, argument, contents): new_list = [ ] if argument == "": shake = 5 speed = 1./30 elif '-' in arguemnt: shake, _, speed = argument.split('-') shake = int(shake) speed = float(speed else: shake = int(argument) my_style = DispTextStyle() for kind,text in contents: if kind == renpy.TEXT_TEXT: for char in text: char_text = Text(my_style.apply_style(char)) char_disp = ScareText(char_text, shake, speed) new_list.append((renpy.TEXT_DISPLAYABLE, char_disp)) elif kind == renpy.TEXT_TAG: if text.find("image") != -1: tag, _, value = text.partition("=") my_img = renpy.displayable(value) img_disp = ScareText(my_img, argument) new_list.append((renpy.TEXT_DISPLAYABLE, img_disp)) elif not my_style.add_tags(text): new_list.append((kind, text)) else: new_list.append((kind,text)) return new_list
for the tag and then
class ScareText(renpy.Displayable): def __init__(self, child, shake=2, speed=1./30, **kwargs): super(ScareText, self).__init__(**kwargs) self.child = child self.shake = shake # The size of the square it will wobble within. self.speed = speed # Include more variables if you'd like to have more control over the positioning. def render(self, width, height, st, at): # Randomly move the offset of the text's render. xoff = (random.random()-.5) * float(self.shake) yoff = (random.random()-.5) * float(self.shake) child_render = renpy.render(self.child, width, height, st, at) self.width, self.height = child_render.get_size() render = renpy.Render(self.width, self.height) render.subpixel_blit(child_render, (xoff, yoff)) renpy.redraw(self, self.speed) return render def visit(self): return [ self.child ]
for the class. I haven't tested that code myself so you might need to fix it if I missed a bug but I think it's good to learn how to debug stuff. Hope this helps and you're able to get it to work how you want it to!