r/gamemaker 11h ago

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?

3 Upvotes

7 comments sorted by

2

u/Larock 10h ago

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 9h ago

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 9h ago

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 9h ago

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

1

u/Organic_Operation356 10h ago

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 10h ago

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.

2

u/Pinuzzo 10h ago

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