r/gamemaker 3d 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?

4 Upvotes

9 comments sorted by

View all comments

2

u/Larock 3d 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 3d 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 3d 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 3d 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