Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Better Rainbows!

TydasTydas Posts: 232Member ✭✭✭ - Distinguished
edited January 2017 in Curing Systems and Scripts
So after my color gradient thing, I decided to improve my rainbow echoes, so I can get truly beautiful rainbow crit echoes. Came across some stuff in my gradient work and bookmarked it, and now I've finished it.

Comes in three types. Type 0, the default, starts from one random color, and slowly moves across the spectrum back to itself when it hits the last color. A smooth, single cycle rainbow effect. Looks great, my personal favorite for crits.

Type 1 gives you the option of setting a frequency. This is basically how big of a step in color each character should take. Lower numbers mean bigger steps. A freq of 1 (and looks like 2) are solid colors. 4 gets a nice random version of that gradient thing I wrote earlier. Higher numbers mean fewer colors shown in return for repeating that cycle across the string. Take a look at the examples.

Type 2 is the old, ugly version I used to use for my crits, and which I posted here a long while back. It's basically a hard-coded type 1 with not-great colors. The other two are much slicker. Kept it mostly because I hate throwing things away.

Called like such:
rainbow("Hey there") -- type 0
rainbow("Hey there", 1) -- type 1, freq is 15
rainbow("Hey there", 1, 5) -- type 1, freq is 5
rainbow("Hey there", 2) -- type 2, if you really must

Examples here.
Edit to add that, some might/be the same on that example. It's because of Lua's sucky random number generator, which is actually C's sucky random number generator, and even though I built in a better version to use I found in the Lua docs, it's still not going to be perfect. That said, you won't be able to tell unless you're rainbowing everything.

Code here
. Code below. Just throw in a script thing in Mudlet.


  • TydasTydas Posts: 232Member ✭✭✭ - Distinguished
    Oh, dammit. It was defaulting to the crappy rainbow. Fixed script here. Blergh.
  • TydasTydas Posts: 232Member ✭✭✭ - Distinguished
    So, someone asked how this all really works, so I thought I'd show you my own crit trigger, and you can copy it, modify it into your own crit triggers, or make new stuff based off it.

    It's a standard trigger, with a regex line that appears so:
    ^You have scored an? ([A-Z\-\s]+) hit!!?!?$
    Then, in the script window below, I have this:

    This selects the line that was triggered, deletes it, then sends the matched line (matches[1] is the entire line that was captured) into the rainbow function, which is sent directly into hecho.

    If you want to use the function elsewhere, you can also store it in a variable.
    rainbow_string = rainbow(string)
    And then elsewhere, do this:
    hecho("This is a rainbow string: " .. rainbow_string)
    A little simplified, but it should show you how to use the function.
  • TahquilTahquil Posts: 3,950Member @@ - Legendary Achaean
    Hey @Tydas : Is there a way that this can be tied into the Svof politics system?
  • OmorOmor Posts: 756Member ✭✭✭✭ - Eminent
    @Tydas this works amazingly well. Thanks!
    Omor Ceberek - Targossas

    got gud
  • TydasTydas Posts: 232Member ✭✭✭ - Distinguished
    Tahquil said:
    Hey @Tydas : Is there a way that this can be tied into the Svof politics system?
    Not that I know of. I'm actually working on ripping that out of svof, since it and the custom prompt are the only two things in svof I really want anymore, and I already did the latter. I figured I'd share it when I finished, and I can probably work this into it. No idea when I'll get that done, though.
  • KenwayKenway San FranciscoPosts: 1,130Member @@ - Legendary Achaean
    Oh you did the two things I was gonna edit your gradient thing to do for me. Thanks yo.

    - Limb Counter - Fracture Relapsing -
    "Honestly, I just love that it counts limbs." - Mizik Corten
Sign In to Comment.