• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Expected Expression [SOLVED]

J

Joshua Hotchin

Guest
Hey everyone,
So i was trying to make a menu following
this tutorial.

I have three events with code:
Creation event for menu object: https://pastebin.com/xaHSeuEE
Cleanup event for menu object: https://pastebin.com/rRVHPtqx
and
Create menu page script: https://pastebin.com/N9UdzkYh

In my create event for my menu on line 53 col 2 i get an expected expression error.
Any help would be appreciated, thanks!

PS: I am also stuck on the replace cursor in my code editor. I am on a Mac and need help. Tks!
 

Simon Gust

Member
You should definetly watch out where you put commas.
If you put one, game maker expects you to add another argument after it.

Watch the video again and look at when a comma is written down.
 
J

Joshua Hotchin

Guest
You should definetly watch out where you put commas.
If you put one, game maker expects you to add another argument after it.

Watch the video again and look at when a comma is written down.
I watched the video again but I can't find what I did wrong. Can you or anyone else see what I did wrong?
 
J

Joshua Hotchin

Guest
Not to worry. I was missing a bracket "]" behind both of my resolution and windowed options. Thank everyone!
 
Code:
// CREATE MENU PAGE
ds_menu_main = sc_create_menu_page(
    ["RESUME", menu_element_type.script_runner, sc_resume_game],
    ["SETTINGS", menu_element_type.page_transfer, menu_page.settings],
    ["EXIT", menu_element_type.script_runner, sc_exit_game],
);

ds_settings = sc_create_menu_page(
    ["AUDIO", menu_element_type.page_transfer, menu_page.audio],
    ["GRAPHICS", menu_element_type.page_transfer, menu_page.graphics],
);

ds_menu_audio = sc_create_menu_page(
    ["MASTER", menu_element_type.slider, sc_change_volume, 1, [0,1]],
    ["SOUNDS", menu_element_type.slider, sc_change_volume, 1, [0,1]],
    ["MUSIC", menu_element_type.slider, sc_change_volume, 1, [0,1]],
    ["BACK", menu_element_type.page_transfer, menu_page.settings],
);

ds_menu_graphics = sc_create_menu_page(
    ["RESOLUTION", menu_element_type.shift, sc_change_resolution, 0, ["1280 x 720", "1920 x 1080",],
    ["WINDOW MODE", menu_element_type.toggle, sc_change_window_mode, 1, ["FULLSCREEN", "WINDOWED",],
    ["BACK", menu_element_type.page_transfer, menu_page.settings],
);
In every single one of those scripts, you have an extra , just before the final );. A comma tells the computer that there's another argument, but you aren't supplying another argument, so it gives you an error.
 
Top