**GM Version**: GameMaker 8 - GameMaker: Studio 1.x. May work on GameMaker Studio 2.

**Target Platform**: ALL

**Download**: Test project download

**Links**: Original blog post on GameDev Palace

__Summary:__In this tutorial you're going to learn how to write 10000 as 10K, 1500 as 1.5k, 1500000 as 1.5m and so on. This can be useful in games where there isn't much space to write the exact numbers, and this may look much cooler. So, let's get going!

__Tutorial:__**Test Project**

For demonstrating this, I have created a test project where the numbers I type will appear with notations. It has just one object and a small room.

**Create Event:**

Code:

```
number = 0;
number_prefix = 0;
number_suffix = "";
number_output = "";
```

**number**will read the numbers I type, from the

**keyboard_string**variable (the variable which stores whatever I type).

**number_prefix**will store the prefix of the notated number (for example, 2, 1.5, 100 and so on) and

**number_suffix**will store the notation (K or M or B). Then

**number_output**will combine those who and show us the final number.

**Draw Event:**

Code:

```
draw_text(5, 5, keyboard_string);
draw_text(5, 37, number_output);
```

**The Main Part**

Getting to the main part - this is where our number notations will be calculated.

**Step Event:**

Code:

```
number = real(keyboard_string);
number_prefix = number;
number_suffix = "";
```

**keyboard_string**(what I type) into a real number using

**real()**and then assigning the value to

**number**. In your case you can just use your variable which you want to be notated (like

**number = score**or

**number = money**).

Then I'm assigning the

**number**value to

**number_prefix**, in case the number doesn't turn out large enough for a notation, it must have some value to show. Same goes for

**number_suffix**, which can stay empty if there's no notation to be done.

**Step Event: (Add the code)**

Code:

```
if (number > 999 && number < 1000000){
number_prefix = number/1000;
number_suffix = "K";
}
```

**number_prefix**to

*and set the number suffix to "K" - denoting a thousand.*

**number**divided by 1000**Step Event: (Add the code)**

Code:

```
if (number > 999999 && number < 1000000000){
number_prefix = number/1000000;
number_suffix = "M";
}
```

**Step Event: (Add the code)**

Code:

```
if (number > 999999999){
number_prefix = number/1000000000;
number_suffix = "B";
}
```

**Step Event: (Add the code)**

Code:

`number_output = string(number_prefix) + number_suffix;`

**number_prefix**, which is a numeric variable, to a string using

**string()**, adding

**number_suffix**to it, and assigning the result to

**number_output**.

**Execute!**

Works so well!

This gives us a number rounded off to two decimal digits. If you want to change this or have more control over the output (i.e., the number of digits/decimals), you can use

**string_format()**instead of

**string()**while converting

**number_prefix**in the last line. Read about the function here.

**Conclusion**

**It just became easier for you to show large values. It looks cool, too!
**

**Thanks for being here, and have a great day!**