Error Messages On Purpose

HexMozart88

The Master of Random Garbage
Veteran
Joined
May 15, 2016
Messages
1,879
Reaction score
3,349
First Language
English
Primarily Uses
RMVXA
Here I will be showing you how to make your game show an error message and crash on purpose. 


So first, we need our message. So in a script call, say


msg = "Text."




That'll set what text is going to come up. 


Next, we need to actually insert it into the message. So in the same script call, right underneath that, put, 



msgbox(sprintf(msg))




Where msgbox is the error window. After you're done that, set your event trigger (I'd recommend player touch). And maybe set a graphic. 


Now it should look something like this:

Screenshot (64).png



But, you'll also notice that the game keeps going after that, but in windowed form. If you would like the game to close directly after, go into your script call, and right below the last line, put "exit" which is the equivalent of saying "SceneManager.exit", which closes the game. Any script calls involving the SceneManager usually don't need a definition, so we don't need to define "exit" either. Now, save your event, and start your game. It should spawn the error message upon touching the event. 


For most, you may not need this in your game (though you never know), but I find this to be a rather good scripting exercise because you can play around with it and take it apart to see what does what. Hope you enjoyed this!    
 

The007who

Call me double 0s
Veteran
Joined
Oct 11, 2015
Messages
118
Reaction score
78
First Language
Italian
Primarily Uses
RMVXA
For me doesn't work... As soon as I trigger the event it sends an error message


Script 'Game Interpreter' line 1411 : Names error occured


unitialized constant Game_Interpreter::Text
 

HexMozart88

The Master of Random Garbage
Veteran
Joined
May 15, 2016
Messages
1,879
Reaction score
3,349
First Language
English
Primarily Uses
RMVXA
I am very surprised that you actually attempted to use this. And I kind of forgot about this tutorial, to be honest. 


But, I kind of overlooked something crucial. Which is, what the script call should look like all together. 


msg = "Insert text here."

Code:
msgbox(sprintf(msg))

exit


So, do you have all of this? (Except for perhaps the exit if you don't want to close the game.)
 

The007who

Call me double 0s
Veteran
Joined
Oct 11, 2015
Messages
118
Reaction score
78
First Language
Italian
Primarily Uses
RMVXA
Yeah now it works, thanks(I forgot the quoration marks XD)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top