Sylphas2005-05-09 04:47:57
This is just a place for me to stick a bunch of scripts I've made up. Feel free to steal them, criticize them, or whatever. I just happen to like some of them, so I thought I'd post them. Anything in italics is comments.
This is mostly just dependencies for neater things.
#CLASS {Utilities|Miscellany}
I use this a lot. Doesn't do all that much, but it makes doing a lot of output a bit easier. Takes each argument, and sticks horizontal lines around it. Works for up to 4 parameters, but it's easy to make it do more. Think of it like a style sheet for output.
#ALIAS display {
#SA %crlf@hLine(78)
#IF (%1) {
#SA %1
#SA @hLine(78)
}
#IF (%2) {
#SA %2
#SA @hLine(78)
}
#IF (%3) {
#SA %3
#SA @hLine(78)
}
#IF (%4) {
#SA %4
#SA @hLine(78)
}
%crlf
}
Simple, outputs a horizontal line of whatever width you want. Display uses 78 to match the output from CONFIG.
#FU hLine {%ansi( blue)%repeat( "-", %1)}
Raises %1 to the power of %2. I haven't actually used it, I coded it just for the hell of it.
#FU pow {%if( %2 = 0, 1, %if( %2 = 1, %1, %eval( %1 * @pow(%1, ))))}
Adds leading spaces to force a number to a certain length. Handy for outputting tables and such.
#FU num {%if( %len( %1) < %2, %repeat( " ", %eval( %2 - %len( %1)))%1, %if( %len( %1) > %2, %rightback( %1, %2), %1))}
Collapses a string by removing apostrophes and spaces. Should probably throw in hyphens and periods and crap like that, but I haven't needed to yet. Used mainly to collapse channel names so I can read them more easily in code.
#FU collapse {%replace( %replace( %1, " ", ""), "'", "")}
#CLASS 0
Next post: Hooking CONFIG so to organize your various scripts!
This is mostly just dependencies for neater things.
#CLASS {Utilities|Miscellany}
I use this a lot. Doesn't do all that much, but it makes doing a lot of output a bit easier. Takes each argument, and sticks horizontal lines around it. Works for up to 4 parameters, but it's easy to make it do more. Think of it like a style sheet for output.
#ALIAS display {
#SA %crlf@hLine(78)
#IF (%1) {
#SA %1
#SA @hLine(78)
}
#IF (%2) {
#SA %2
#SA @hLine(78)
}
#IF (%3) {
#SA %3
#SA @hLine(78)
}
#IF (%4) {
#SA %4
#SA @hLine(78)
}
%crlf
}
Simple, outputs a horizontal line of whatever width you want. Display uses 78 to match the output from CONFIG.
#FU hLine {%ansi( blue)%repeat( "-", %1)}
Raises %1 to the power of %2. I haven't actually used it, I coded it just for the hell of it.
#FU pow {%if( %2 = 0, 1, %if( %2 = 1, %1, %eval( %1 * @pow(%1, ))))}
Adds leading spaces to force a number to a certain length. Handy for outputting tables and such.
#FU num {%if( %len( %1) < %2, %repeat( " ", %eval( %2 - %len( %1)))%1, %if( %len( %1) > %2, %rightback( %1, %2), %1))}
Collapses a string by removing apostrophes and spaces. Should probably throw in hyphens and periods and crap like that, but I haven't needed to yet. Used mainly to collapse channel names so I can read them more easily in code.
#FU collapse {%replace( %replace( %1, " ", ""), "'", "")}
#CLASS 0
Next post: Hooking CONFIG so to organize your various scripts!
Sylphas2005-05-09 04:51:37
Not much too this. Adds various scripts to the end of CONFIG, so you can see their status at a glance, and be a bit organized. Nothing difficult, just a basis for the rest of my scripts to work from so I don't have to screw with them so they work without CONFIG
Privacy Overview
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Strictly Necessary Cookies
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.