? DEFY Code Library 1.7.8 ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

DEFY Code Library 1.7.8

Submitted
Updated
Author
ColeslawProductions
Public Key
7KE3XERM
Min. Compat.
All
Version
1.7.8
Size
8685
Rating
5 votes
Description From my trend of mostly making DEF blocks, I decided to compile these blocks into a library file allowing for cleaner coding. Addition 1/7/16: I have still been editing the code on my own, but I haven't been uploading it since V1.4.1. Now I have a function which I am fairly proud of and want to shove in your face. Coleslaw Productions Hashing Algorithm 2! CPHA2$() Yes, 2. I have made a hash algorithm in August 2014 for Petit Computer. (I don't like it anymore.) I decided to try again, and I think this one is much better, though I still don't believe it could combat MD5. Anyway, it takes a string and returns a hash of 256 hexadecimal digits. It takes 15 seconds to hash a 32kb string. (Tested on New 3DS XL) I hope you guys like it. You can help with the development of DEFY by leaving suggestions in the comments. Included commands: DEFYLOGO Displays the DEFY splash screen on the console. CPHA2$(String$) Returns the result of the hashed string. GBLUR Start point X, Start point Y, End point X, End point Y, Blur Radius PRINTAT X, Y, String$ Prints a string on the graphics screen with the given coordinates, regardless of the current cursor position. GBEZIER Start point X, Start point Y, End point X, End point Y, Relative deviation X, Relative deviation Y, Color GGRADIENT Mode (|b00| 0=Horozontal 1=Vertical |b01| Crude dithering 0=Off 1=On), Start point X, Start point Y, End point X, End point Y, Color 1, Color 2 HSV(Hue in degrees 0 to 359, Saturation between 0 and 1, Value between 0 and 1) UPPER$(String to convert to uppercase) LOWER$(String to convert to lowercase) REVERSE$(String$) Returns the input string reversed. XORSTR$(S1$ as String, S2$ as String) Performs an XOR operation two strings. RNDSTR$(Length as Integer, Start character as integer, End character as integer) Retruns a randomized string of a specified range of characters. STRTOHEX$(String$,Digits per character as integer) Returns hexadecimal digits encoding the given string. HEXTOSTR$(Hex digits as string,Digits per character as integer) Retruns the string encoded in hexadecimal digits. MAPRANGE(Number, A1, A2, B1, B2) Maps a number from one range to another. ROTATEP Point X, Point Y, Origin X, Origin Y, Angle in radians OUT Output X, Output Y CAP(Number, Minimum number, Maximum number) Only allows a number to be within a given range ABSTIME() Returns the the time of day in total seconds. READBIT(Integer, Bit selector) Returns the boolean value of a single specified bit in an integer. SETBIT(Integer, Bit selector, Value) Sets the value of a single bit in an integer, leaving the other bits as-is. BGSTR Layer, X, Y, String$ Draws a string on the BG screen. DISTANCE(X1, Y1, X2, Y2) Calculates distance between two points. RNDCOL() Returns a random color value. INF() Returns Infinity. NAN() Returns NaN. CR$() Returns carriage return. LF$() Returns line feed. NUL$() Returns null. TOPOINT(X,Y) Converts integers between ±32767 and NaN into DEFY's point type. This function is similar to RGB() GETX(Point) Extracts X value from Point type value. GETY(Point) Extracts Y value from Point type value. INTERP(N as Percentage, P1 as Point, P2 as Point) Returns an interpolated point between P1 and P2 determined by N. TOUCHP() Returns touch coordinates as Point. Returns 0 if the touch screen is not touched. FADECOL(N as Percentage, C1 as Color, C2 as Color) DITHER(Color) Adds RND(8) to R, G, and B for dithering. GRAY(L as Integer) Returns RGB(L,L,L). Returns grays. SWITCH(C as Boolean, A as Variable, B as Variable) Returns A if C is logically true. If not, returns B. SDIV(Dividend, Divisor, Default) Returns quotient if divisor is not zero. If zero, default is returned. GLINER X1,Y1,X2,Y2, Color, Thickness | Draws a line with defined thickness. FACT(N as Positive Pnteger) Returns factorial of N. WAITSEC D as Seconds WAITMS D as Milliseconds HSVREAD C as 32bit RGB OUT Hue from 0-360, Saturation from 0-1. Value from 0-1 PHI() Returns Phi. (1.61803399) Instructions Load the library file into an alternate slot and make it usable via the USE command. USE "PRG?:DEFY.LIB" (Where "?" can be 0-3 to choose a program slot.) After that, just write the listed commands normally into your code.
Categories
Keywords
  • DEFY
  • Code
  • Library
7 Comment(s) 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website A useful function is WRAP, which is like MOD but works with negatives. DEF WRAP(VALUE,HIGH) WHILE VALUE<0 INC VALUE,HIGH WEND RETURN VALUE MOD HIGH END MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies hahaha, i created my own def function named CAP and its the same thing as yours, here. I also created a DEF function called CUP, which sets the minimum value for an interger variable. Mine only set a minimum value or maximum value, not both at once. Also, you should add a function for defining the maximum amount or minimum amount of characters in a string. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website Add link to discussion thread: http://www.smilebasicsource.com/forum?fpid=3613#post_3613 snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself Heads up, BIN$() is becoming a builtin in 3.3.0. ColeslawProductions ColeslawProductions I'll remove it when it comes out. ahavasandwich ahavasandwich Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Pokemon Is Awesome! I love Pokemon! Express Yourself Minecraft Is Awesome! I love Minecraft! Express Yourself I'm going to study this. Thanks for sharing. :) ColeslawProductions ColeslawProductions Have fun with it!