INTRODUCTION TO XISOL 30K

Xisol 30k or XGBG30000 is a special calculator originally meant for absolutely no unique purpose. It was made just to do calculations. But now it can do nice graphing and stuff.

I'm going to introduce you to the program step by step. So, let's start with some simple calculations. Type in 6+5+8 and press Enter. Got 19? Good.
If you enter 6+5*8, it calculates the 5*8 first, like a good boy. Let's test that out. 46... does that make sense? 6+5*8 = 6+40 = 46. Good.
For exponentiation we can't use ^, since that represents bitwise XOR. (Likewise, | represents bitwise OR, and & represents bitwise AND.) This is where we get into the magic of functions.

FUNCTIONS

Functions can be many things, but for now we'll focus on mathematical ones. All functions are in a language called GML.
Try power(11,2) to get 11, or 121.
Try sqrt(121) to get 11.
log10(2485) gives you 3.40.
sin(pi*0.5) gives you 1. Note that in the sin(x) function, x is measured in radians. If you prefer to enter degrees, you have to convert them to radians first, in this manner: sin(degtorad(x)).

Here are some more functions for you to play with.
Functions marked with an asterisk * are exclusive to the Xisol 30k and are not part of GML. They are, however, executed in the exact same way as normal GML functions.

logn(n,x) - Calculates log base-n of x. Note that the function name is always logn - regardless of what base you are using!
The following two functions are exceptions to this rule:
log2(x) - Calculates log base-2 of x.
log10(x) - Calculates log base-10 of x.
ln(x) - Calculates natural logarithm (base-e) of x.
sin(x), cos(x), tan(x), arcsin(x), arccos(x), arctan(x) - Standard trigonometric functions. Remember that x is always measured in radians (see above).
round(x) - Rounds to the nearest integer.
floor(x) - Rounds down to an integer.
ceil(x) - Rounds up to an integer.
frac(x) - The fractional part of x. For example, frac(56.29) = 0.29.
min(x1,x2,x3...x16), max(x1,x2,x3...x16), mean(x1,x2,x3...x16), median(x1,x2,x3...x16), choose(x1,x2,x3...x16) - These functions can have up to 16 arguments. min returns the smallest value, max returns the largest, mean returns the average, median returns the middle value, and choose returns a random value.
random(x) - Random, non-integer number between 0 and x. The number is always smaller than x.
Can you find the difference between round(random(x)), floor(random(x)), and ceil(random(x))? Each one does something else :)

What makes Xisol 30k a special calculator is the ability to handle strings (letters and words) correctly, in addition to real-valued functions.
However, there is one major difference: When entering a string, it MUST be enclosed in "quotation marks".
For example: typing hello will not work, but typing "hello" will display hello.

String functions are probably not as useful as real-valued ones; however, they may still come in handy eventually.

string_lower(str) - the string in lowercase letters.
string_upper(str) - THE STRING IN ALL CAPS.
(Bronies may know this as the Royal Canterlot Voice, so the function is also available as canterlot(str).* For example: canterlot("Oh, most wonderful of nights!") = OH, MOST WONDERFUL OF NIGHTS!)
real(str) - Turns str into a real number.
string(val) - Turns val into a string. This may be useful when wanting to concatenate strings with real numbers.
string_length(str) - Number of characters in the string.
string_char_at(str,index) - The character in str at position index. A value of 1 for index represents the first character.
chr(val) - Character with ASCII code val. Can be used for entering special characters. For example: chr(234) = .
ord(str) - The antithesis of chr(val). Returns the ASCII value of the first character in str. For example: ord("G") = 71.
get_string(prompt,default) - Opens a dialog box that prompts the user for a string. prompt indicates what text will appear above the text box. default indicates the default value for the text box.

There are many other functions that return values. I'm not going to reveal all of them here, but you can find them all in the GML reference: http://www.gmlscripts.com/gml/game_maker_language.

VARIABLES

The Xisol 30k has variables that can be set and read easily.

set_a(x),* set_b(x),* set_c(x)* - Assign values to variables a, b, c.
To use these variables in an expression, just use their name: 12*(a-7)*(a+3*a)

DRAWING AND GRAPHING

The Xisol 30k can draw any kind of function or math-based drawing. Drawing is not easy, but the end result can look very good.
To execute a series of drawing commands, press Shift+Enter.

draw_text(x,y,str) - draw text str at position x,y.
draw_line(x1,y1,x2,y2) - draws a line from point x1,y1 to point x2,y2.
draw_arrow(x1,y1,x2,y2,size) - draws an arrow from point x1,y1 to point x2,y2. size indicates the size of the arrow head.
draw_rectangle(x1,y1,x2,y2,outline) - draws a rectangle with corners at x1,y1 and x2,y2. If outline is 1, only the outline is drawn; otherwise, the rectangle is filled.
draw_roundrect(x1,y1,x2,y2,outline) - same as above, except the rectangle is rounded.
draw_ellipse(x1,y1,x2,y2,outline) - same as above, except this function draws an ellipse.
draw_circle(x,y,r,outline) - draws a circle with center at x,y and radius r.
draw_triangle(x1,y1,x2,y2,x3,y3,outline) - draws a triangle with points at x1,y1, x2,y2, and x3,y3.

PROGRAMMING THE CALCULATOR

When you use functions, Xisol 30k can perform many, many different actions. To execute a piece of code, press Ctrl+Enter.

There are many functions and commands of all kinds that you can mess with. In addition, most usual code constructions can be used with the Xisol 30k. These include loops, condition checking and user-defined variables. Again, the GML reference contains all of them: http://www.gmlscripts.com/gml/game_maker_language

Note: If a function only returns a value, without doing anything else, don't run it with Ctrl+Enter - nothing will happen.

SCRIPTS

The Xisol 30k comes with a few example scripts that demonstrate its features. These are written in GML and have the extension *.gml. They can be run using the execute_file() function, as follows:
execute_file(filename,arg0,arg1,arg2...arg15)
The parameters arg0 through arg15 are optional - they only need to be entered if the script actually uses them. Below is a list of all scripts and guidelines on how to run them.

execute_file("CheckNames.gml") - Prompts the user for a first name and a last name, and checks which of them is longer. Press Ctrl+Enter to run.
execute_file("MultiTable.gml",cols,rows,x,y) - Draws a multiplication table. cols indicates the number of columns, rows indicates the number of rows, x and y indicate the position of the top-left corner of the table. Press Shift+Enter to run.
execute_file("Spiral.gml") - Draws a spiral. Press Shift+Enter to run.

FONT

Can't stand the font? No worries!
Use the function font_replace(ind,name,size,bold,italic,first,last) with the following values:
ind and first should always be set to 0.
last should always be set to 255.
name is the name of the font you want to change to, such as "Arial" or "Courier New". Since the name is a string, it must be enclosed in "quotation marks". Bitmap fonts, such as "WST_Engl" or "Fixedsys", also work.
size is best left at 18, but if for some reason you want to change it, go ahead.
bold indicates whether the font should be bold (1) or regular (0).
italic indicates whether the font should be italic (1) or roman (0).

The following example is valid:
font_replace(0,"Dutch801 Rm BT",18,0,1,0,255) sets the font to 18-point italic Dutch801 Rm BT.

For a quick font change, just enter i_hate_this_font(). This function is Xisol-exclusive.

CREDITS

Programming by Cmaflec Klakans. Text-to-Speech extension by Bram Buurlage.

HAVE FUN!