SOLVED Doubt / Problem with the number of asteroids in Space Rocks DnD Tutorial

Hello community!
I wanted to share with you something that happened to me doing the Space Rock tutorial #5, and know if you can explain to a total noob like me what this error is due to ...

In the tutorial she asks me to use the REPEAT command so that 6 asteroids appear (see screenshot below).
But if I put the number 6, I get this error:

############################################################################################
ERROR in
action number 1
of Other Event: Room Start
for object obj_game:

Variable obj_game.room_heigth(100016, -2147483648) not set before reading it.
at gml_Object_obj_game_Other_4 (line 86) - var yy = floor(random_range(0, room_heigth*0.3 + 1));
############################################################################################
gml_Object_obj_game_Other_4 (line 86)

BUT, if I reduce the number to 4, the game does not give me an error and starts ...

What could be happening?
Someone could explain to me to learn (remember that I DO NOT KNOW ANYTHING and I'm just starting).

From already thank you very much!

Screen Shot 09-27-20 at 10.11 PM.JPG

Screen Shot 09-27-20 at 10.20 PM.JPG
 
Last edited:

Slyddar

Member
The "he" is a "she", and the error is saying the variable room_heigth is not known. That is because it is spelt incorrectly. It should be room_height.
 
Last edited:
The "he" is a "she", and the error is saying the variable room_heigth is not know. That is because it is spelt incorrectly. It should be room_height.
Can I be so stupid? Yeah! I can be so dumb...
Between the fact that my eyesight is not what it was and my native language is Spanish, well ... sorry for making you wasting your time with this.

Tonight I'll look for the misspelled word and correct it to see how it turns out.

The good news is that you have a new follower on Youtube! your platformed tutorials look great!

Thanks for the reply @Slyddar !
 
It's always important to look at the error, and look at the line number and see why it is complaining. The errors are usually pretty good at pointing out the problem.
And thanks for the follow, hope you find the tutorial useful.
Another question: the best way to "find" the error is to use the Debug option?

Seeing the "written" message like the one I posted above, I didn't realize where the problem was ... I guess it's a lack of experience...

As I do your tutorials, I will give you feedback on YouTube!

Thanks again.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Using the debug module primarily becomes helpful when you don't have an error message to work with.
If you get an error message, that usually tells you everything you need to know. Debug mode to resolve an error message is like cutting paper with a chainsaw - works, but there's probably an easier, faster and less clunky way.

The best way to deal with those is to pay very close attention to what the error message states - and by that, I mean the entire message, including the cited code - as well as the code surrounding that code. If you're unsure what an error message means, consult the manual's Runner Errors and Syntax Errors pages.

After that, quite frequently, deduction can lead you to the source. Let's see... my train of thought would probably be something like this, assuming I don't spot the typo immediately:


What does "Variable obj_game.room_heigth(100016, -2147483648) not set before reading it." tell me?

It tells me that the error occurs in obj_game.
It's about a variable.
The variable is room_heigth.
The problem with it is that it was not set before reading it.
This means that I tried to read from it, but it had no value.
It has no value because it doesn't exist.
It doesn't exist because I didn't declare it.

Was I even supposed to declare it?
No, it's a default variable. It always exists.
If it doesn't, that's either an error with the engine (very unlikely) or the variable I'm trying to use is actually not a default variable.
Let's look it up in the manual... room_height.
Yup, sounds about right. That definitely is a default variable.
Let's copy it to my code, just to make sure.

Suddenly, it works.
I must have misspelled it.
 
@TsukaYuriko, thank you very much for taking the time in such a complete answer! and for posting links to useful information!

Reading your train of thought, it sounds super logical now 🤦‍♂️

I think I was scared when I saw these numbers.
Variable obj_game.room_heigth(100016, -2147483648) not set before reading it.
There I completely lost myself.

But if I had not given so much importance to those numbers that I did not understand, and read the rest with more attention, perhaps I could have "figured out" what the problem was.

I realized during this tutorial (the first one I do) that you have to change your mindset and start thinking with a programming logic when it comes to precisely knowing which elements to use in GM to ... program.

Thanks again for the guidance!
 

TsukaYuriko

☄️
Forum Staff
Moderator
I see. Glad I was able to help! :)

For the sake of completeness (loosely adapted from the Runner Errors page):
Out of those numbers, the first (100016) is the ID of the instance that caused the error. This may actually be helpful information for you if you have multiple instances of the same object in the room, but only one of them is encountering issues.
The second (-2147483648) is an internal value used by YoYo Games to identify bugs and can be ignored according to the manual.
 
Top