## A Textual Adventure – MathStudio Tutorial

Several weeks ago, we released the first stable version of MathStudio, our free technical IDE. Let’s play with some of the new built-in functions!

You can use GoManga MathStudio not only to make technical application. A new year is coming, and we know that it’s boring to talk about maths during the Christmas holidays, so in this blog post we are going to show how you can make a simple textual adventure using the MathStudio language.

Making a good introduction is one of the most important things to do when you make a textual adventure: it’s the first thing that the player sees! Choose your background and foreground color wisely. You can use the bcolor and the tcolor functions to do this.

Now it’s the time to introduce your player to your narrative universe: be creative! Use the wait function to improve the climax and even change text and/or background colors to make your adventure look beautiful.

After that it’s the time to code the game itself. What is your gameplay? Are you going to make your player choose between different choices? Are you going to make your player insert an action to do? Just be creative!

In the example below we make the player choose between several different choices using the switch construct. We are actually allowing the player to explore our envirorment:

```:init
clear
output.
output.
output You are locked inside a classroom. You have to escape.
output.
output Where are you going?
output.
output 1 - To the door
output 2 - To the interactive whiteboard
output 3 - To the puzzle on the first table
output 4 - To the teaching post
output 5 - To the locker
output 6 - To the windows
output.
[choice] = input

switch {choice} then
case 1 then
clear
output.
output.
output The door is closed. You have to find a different way to escape.
output.
output Press any key to go back...
pause
goto init
endcase
case 2 then
goto iwb
endcase
case 3 then
goto table
endcase
case 4 then
goto teachPost
endcase
case 5 then
goto locker
endcase
case 6 then
clear
output.
output.
output The windows are to high to jump. You have to find a different way to escape.
output.
if {flashlight} = 0 then
output There is a strange flashlight on the sill, it can be useful, so you pick up.
output.
[flashlight] = 1
endif
output Press any key to go back...
pause
goto init
endcase
default then
goto init
enddefault
endswitch
```

This is just a piece of our present for you: a free, playable and open source textual demo inspired by Narcissic Pulse, our new VR game.