Sections

  • Search Chrome Cow

Design a Day

User-Defined Functions for LScript

Over the years, I created a number of UDFs for various plugins that I’ve released on the Chrome Cow. As all my scripting is uncompiled, they have been available the whole time to those who were willing to look. Here they are in a much easier to find format. Enjoy! If anyone has other UDFs they think might be useful to the community, feel free to send them in, along with how you want to be credited, and I will post those too.

UDFs Description
dec2Bin.ls Takes a decimal number, and returns a binary number padded to length (len).
getFloat.ls

LScript’s method for writing floats, writeNumber(), is broken (v2.6). getFloat returns 4 values that should be written sequentially with the writeByte() method. They should be written in the order they’re returned.
Special thanks to Ernie Wright and TAZ

Superceeded by Ernie Wright’s Agnostic File I/O

hex2dec.ls Takes a single digit hexidecimal number and returns a decimal value.
hexpair2dec.ls Takes a two digit hexidecimal number and returns a decimal value. Calls the UDF “hex2dec.”
miscCenterAlign.ls A collection of UDFs for centering and aligning Objects or Selections.
rgb2hsb.ls Send it R-G-B values, converts it to HSB (Hue, Saturation,Brightness) colorspace. Also used in my color search engine.
tgaSwatch.ls Writes a 16×16 single-color TGA file to disk. Used to create color swatch previews for my color search engine script. May be of interest to folks wanting to understand TGA files.

Ernie Wright’s
Agnostic File I/O

UPDATED 04/12/2004
Now supports reading and writing of Doubles, 8 byte IEEE Floating Point

Lscript’s file I/O has a number of bugs for those wanting to read/and write Floats, and for those who want to make their file code platform agnostic. LScript’s current incarnation fails to properly handle Big Endian/Little Endian byte order issues.

Special thanks to Ernie Wright, both for writing the code to handle writing floats (and ints, and shorts) and dealing with byte order, and for allowing me to post it here.



Share This Post

del.icio.us:LScript UDFs digg:LScript UDFs wists:LScript UDFs magnolia:LScript UDFs segnalo:LScript UDFs Submit to Slashdot Submit to BoingBoing Submit to Make


Leave a Reply

Comment Preview




All comments are subject to the Rules.