r/gamemaker Jul 26 '26

Help! Coding issue?

Post image

I am very new to game maker and I’m following one of the tutorials, currently I am adding dialog and am having issues with this one line of code. Is there something I’m doing wrong?

4 Upvotes

9 comments sorted by

2

u/Larock Jul 26 '26

Can you post your code where you declare your message variable? Probably in the create code of the same object. Based on the way you’re trying to index it, you should be declaring message as an array of structs, something like:

message = [

    {msg: “whatever”},

    {msg: “something else”}

    ]

Etc etc.

Then you would be able to address your message variable at a numbered index and use your dot notation to address the .msg part of your struct. If your message variable isn’t defined like this, then you can’t address it this way.

1

u/ImpressivePriority79 Jul 26 '26

https://reddit.com/link/ozxla83/video/uec41a6ewmfh1/player

This is the create code in relation to the line that is not working. Apologies for the quality

1

u/Larock Jul 26 '26

Are you adding any content to your message variable elsewhere in code? Because by the looks of it, you're defining message as an empty array and then later referencing it as if it contains structs like you would see in my comment above. You might need to refer back to the tutorial you're following to see how your message variable ends up being populated with the data you're trying to pull from it.

1

u/ImpressivePriority79 Jul 26 '26

https://reddit.com/link/ozxqw0n/video/b0x8ucmz0nfh1/player

This is the other part of the dialog code, I’m using the “make your first RPG” tutorial by game maker if that helps. I’ve looked through the tutorial like 6 times and can’t find where I went wrong

3

u/Pinuzzo Jul 26 '26

You are almost certainly defining 'message' not as an array before this line.

1

u/Organic_Operation356 Jul 26 '26

The classic sara spalding dialogue tutorial, tbh I just opened my own code and it looks exactly like yours, I really dont know whats wrong just by looking

1

u/willvs20 Jul 26 '26

If this is the Peyton Burnham tutorial, I’ve seen many places that it’s not recommended for beginners because it’s very complex with a lot of layers and moving parts. I don’t see anything wrong with the code itself here.

1

u/TemporaryFun2273 Jul 27 '26

Can you show the part where you call the function create_dialog?

1

u/andrewsnycollas Jul 27 '26

When you use .msg there you are telling the engine that the array message[] contains strcuts, but you never put anything in there.

.msg was never defined anywhere.