Updating old Game Maker for Mac projects

Sharadise

Member
Hello,



I'm currently in the process of upgrading my old Game Maker for Mac (GM7?) projects to GMS 2.

To do this I first have to import the old .gmk files into GMS 1.4, however what I hit 'play' in GMS 1.4 I am getting some errors, and I have no clue what they mean or how to fix them.



First I get an error saying: "The filename, directory name, or volume label syntax is incorrect.", then what I press 'OK' I get a 'Compile Errors' window containing the following:

"

Compile error in around line 0 : room missing "rooms\_IT_MOVES?!?"

In Object obj_shell_creature, in Event CreateEvent action number 1 at line 1 : got 'creature' expected ',' or ')'

In Object obj_shell_creature, in Event CreateEvent action number 1 at line 1 : got 'creature' expected ')'

In Object obj_shell_creature, in Event CreateEvent action number 1 at line 1 : wrong number of arguments for function action_sprite_set

Compile Failed - Please check the Compile window for any additional information

"



It's been a long time since I've done anything with Game Maker (or Windows in general), and I'm clueless at to what to do. I only have a temporary GMS 1.4 licence, so my time window in which I can fix these issues it very limited.



Any help/hints would be greatly appreciated.



Thank you!
 

FrostyCat

Member
You must first make sure all the resource names are valid before attempting to import, as GMS no longer tolerates "fancy" names like legacy GM. Open your old project in GM:Mac if you still have it or LateralGM if you don't, then rename every resource identified as invalid under Scripts > Check Resource Names until the list is empty. Only then you can attempt the import.

By definition, a valid resource name must:
  • Consist only of alphanumeric characters and underscores (A-Z, a-z, 0-9, _)
  • The first character must not be a number
  • Be completely unique among all resources in the project
 

Sharadise

Member
You must first make sure all the resource names are valid before attempting to import, as GMS no longer tolerates "fancy" names like legacy GM. Open your old project in GM:Mac if you still have it or LateralGM if you don't, then rename every resource identified as invalid under Scripts > Check Resource Names until the list is empty. Only then you can attempt the import.

By definition, a valid resource name must:
  • Consist only of alphanumeric characters and underscores (A-Z, a-z, 0-9, _)
  • The first character must not be a number
  • Be completely unique among all resources in the project
Thanks, that helped a lot!

I've now started importing the next project, and I'm getting a lot of errors about obsolete functions: "message_background", "show_message_ext", "message_button", with what functions have these functions been replaced (and how do I update them)? I'm also getting an error message saying "Action contains obsolete function: action_set_timeline This will need to be replaced before compiling." what does "action_set_timeline" need to be replaced with?

Many thanks!
 

FrostyCat

Member
Thanks, that helped a lot!

I've now started importing the next project, and I'm getting a lot of errors about obsolete functions: "message_background", "show_message_ext", "message_button", with what functions have these functions been replaced (and how do I update them)? I'm also getting an error message saying "Action contains obsolete function: action_set_timeline This will need to be replaced before compiling." what does "action_set_timeline" need to be replaced with?

Many thanks!
The blocking message functions have been dramatically scaled back in GMS 2 for cross-platform compliance reasons. You have to completely move off the likes of message_*() and show_message_ext() and emulate them using non-blocking objects instead (e.g. 3 button objects that each do something different when clicked). This won't be a copy-and-paste conversion, and you should expect having to re-architect the affected parts of your project.

action_set_timeline() refers to the drag-and-drop action for starting a timeline. This is the new way of starting a timeline:
Code:
timeline_index = tml_example;
timeline_position = 0;
timeline_running = true;
 

Sharadise

Member
The blocking message functions have been dramatically scaled back in GMS 2 for cross-platform compliance reasons. You have to completely move off the likes of message_*() and show_message_ext() and emulate them using non-blocking objects instead (e.g. 3 button objects that each do something different when clicked). This won't be a copy-and-paste conversion, and you should expect having to re-architect the affected parts of your project.

action_set_timeline() refers to the drag-and-drop action for starting a timeline. This is the new way of starting a timeline:
Code:
timeline_index = tml_example;
timeline_position = 0;
timeline_running = true;
Thanks! I am aware that these projects will likely need a lot of work to get working again, and I am willing to put that time in, if I knew what to do (or where to find out what do to).
Speaking of, I've started converting my next project and I'm getting a lot of errors in GMS 1.4, but I didn't get any warnings about obsolete functions, so I believe that this must be a change in GML?
"
In Object obj_mushroom_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ',' or ')'​
In Object obj_mushroom_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ')'
In Object obj_electronics_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ',' or ')'
In Object obj_electronics_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ')'
In Object obj_reeroomer, in Event StepNormalEvent action number 1 at line 1 : Assignment operator expected
In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ',' or ')'
In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ')'
In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ',' or ')'
In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ')'
In Object obj_solar_panel, in Event CreateEvent action number 2 at line 1 : cannot use function/script name for a variable, using "power"
In Object obj_solar_panel, in Event CreateEvent action number 2 at line 1 : malformed assignment
In Object obj_solar_panel, in Event ObjAlarm1 action number 2 at line 5 : cannot use function/script name for a variable, using "power"
In Object obj_solar_panel, in Event ObjAlarm1 action number 2 at line 5 : got '100' expected ')'
In Object obj_solar_panel, in Event ObjAlarm1 action number 2 at line 5 : wrong number of arguments for function action_if_variable
In Object obj_solar_panel, in Event ObjAlarm0 action number 2 at line 10 : cannot use function/script name for a variable, using "power"
In Object obj_solar_panel, in Event ObjAlarm0 action number 2 at line 10 : got '4' expected ')'
In Object obj_solar_panel, in Event ObjAlarm0 action number 2 at line 10 : wrong number of arguments for function action_if_variable
In Object obj_solar_panel, in Event StepNormalEvent action number 1 at line 1 : cannot use function/script name for a variable, using "power"
In Object obj_solar_panel, in Event StepNormalEvent action number 1 at line 1 : unexpected symbol ">" in expression
In Object obj_solar_panel, in Event StepNormalEvent action number 1 at line 1 : malformed assignment
In Object obj_solar_panel, in Event DrawEvent action number 1 at line 2 : cannot use function/script name for a variable, using "power"
In Object obj_solar_panel, in Event DrawEvent action number 1 at line 2 : got 'c_gray' expected ')'
In Object obj_solar_panel, in Event DrawEvent action number 1 at line 2 : wrong number of arguments for function draw_healthbar
In Object obj_electric_light_off, in Event CreateEvent action number 22 at line 3 : cannot use function/script name for a variable, using "power"
In Object obj_electric_light_off, in Event CreateEvent action number 22 at line 3 : malformed assignment
In Object obj_electric_light_off, in Event StepNormalEvent action number 1 at line 1 : cannot use function/script name for a variable, using "power"
In Object obj_electric_light_off, in Event StepNormalEvent action number 1 at line 1 : malformed assignment
In Object obj_reeroomer, in Event StepNormalEvent action number 1 at line 1 : malformed assignment statement
In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement
In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement
In Object obj_solar_panel, in Event ObjAlarm1 action number 2 at line 5 : malformed assignment statement
In Object obj_solar_panel, in Event ObjAlarm0 action number 2 at line 10 : malformed assignment statement
In Object obj_solar_panel, in Event StepNormalEvent action number 1 at line 1 : malformed if statement
Compile Failed - Please check the Compile window for any additional information
"

I believe that most these errors are related to global variables (e.g. "global.happiness" in the case of the first error).
Here's my 'Global variables script (scr_global_var_set)', I hope it helps:
"
//global things
global.globalgoing = 0;
global.time = 0;
global.cheats = false;
global.happiness = 0;
global.fullness = 100;
global.maxFullness = 100;
global.Pspeed = 4.5;
global.ch = false;

//Inventory and crafting
global.waterC = 0;
global.crystalBC = 0;
global.rocksC = 0;
global.grassC = 0;
global.flower1C = 0;
global.dryGrass = 0;
global.treeC = 0;
global.active = 0;
global.clothing = 0;
global.MBBC = 0;
global.bariocoliptiostoulsC = 0;
global.boxesC = 0;

// P inventory
global.inventoryItems = 0;
global.stones = 0;
global.grass = 0;
global.largeGrass = 0;
global.logs = 0;
global.campFires = 0;
global.branches = 0;
global.mareenadumCrystals = 0;
global.sunflowerSeeds = 0;
global.magentarberrys = 0;
global.mareenadumPicks = 0;
global.bariocoliptiostouls = 0;
global.mushroomBooks = 0;
global.electronicsBooks = 0;
global.stoneTiles = 0;
global.ash = 0;
global.solarCells = 0;
global.solarPanels = 0;
global.pepper = 0;
global.powerExits = 0;
global.stannum = 0;
global.electricLights = 0;
global.accumulators = 0;
global.wrenches = 0;
global.powerDeflectors = 0;

//skills
global.skillPoints = 0;
global.mushroomIDs = 0;
global.MPP = 0;
global.electronics = 0;

"

I know that asking for so much help might be a lot to ask, but I really need help with this (or at least where I can get more information on where I can learn (or re-learn in some cases) how to fix these things myself).

Many thanks!
 

FrostyCat

Member
You are using power as a variable/resource name (which is invalid because it's a built-in GM function), and the rest just looks like code broken by invalid resource names. Please, stop skipping that Scripts > Check Resource Names step, and fix all your resource names before trying to import.
 

Sharadise

Member
You are using power as a variable/resource name (which is invalid because it's a built-in GM function), and the rest just looks like code broken by invalid resource names. Please, stop skipping that Scripts > Check Resource Names step, and fix all your resource names before trying to import.
I looked through the entire resource name list before writing (Scripts > Show Resource Names) and I couldn't find any that had illegal symbols (non A-a, 0-9, or underscore symbols). Maybe I missed some, I'll look again. I didn't realise "Power" was illegal as well. Does it count if "power" is only part of the variable name (e.g. "global.powerDeflectors")?

Edit: re-naming "power" to "powerVar" has fixed many of the errors. I still don't see how the object names "obj_mushroom_book_I", "obj_electronics_book_I", "obj_reeroomer", "obj_mushroom_parts", "obj_electronics", constitute illegal names? Or are these not the issue?
 
Last edited:

FrostyCat

Member
Post the code from the places still showing errors. Also, put the code between [code] and [/code], so that it can show up like this:
Code:
// Properly formatted code
 

Sharadise

Member
Post the code from the places still showing errors. Also, put the code between [code] and [/code], so that it can show up like this:
Code:
// Properly formatted code
Ah, I was wondering how to do that.
This is the errors log:
Code:
    In Object obj_mushroom_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ',' or ')'
    In Object obj_mushroom_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ')'
    In Object obj_electronics_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ',' or ')'
    In Object obj_electronics_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ')'
    In Object obj_reeroomer, in Event StepNormalEvent action number 1 at line 1 : Assignment operator expected
    In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ',' or ')'
    In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ')'
    In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ',' or ')'
    In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ')'
    In Object obj_reeroomer, in Event StepNormalEvent action number 1 at line 1 : malformed assignment statement
    In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement
    In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement
    Compile Failed - Please check the Compile window for any additional information
 

FrostyCat

Member
I said post the code from those places showing the errors, not the error itself.

If I remember correctly, functions for changing sprites and backgrounds got a different set of arguments during the transition to GM8. Check the Manual and update those first.
 

Sharadise

Member
I said post the code from those places showing the errors, not the error itself.

If I remember correctly, functions for changing sprites and backgrounds got a different set of arguments during the transition to GM8. Check the Manual and update those first.
Sorry.
It's been a very long time since I last used Game Maker, and most my code is still in drag and drop format and I'm not entirely sure on how I would post that (I'm only now getting used to Game Maker's UI again). I'll see what I can find in the manual.

Thanks!
 

Sharadise

Member
If it's drag-and-drop, you can post a screenshot.
Double clicking on error 1 (In Object obj_mushroom_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ',' or ')') shows me this:
1.png
Double clicking on error 2 (In Object obj_mushroom_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ')') shows me the exact same thing.
Double clicking on error 3 (In Object obj_electronics_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ',' or ')') shows me this:
2.png
Double clicking on error 4 (In Object obj_electronics_book_I, in Event RightButtonReleased action number 1 at line 20 : got ';' expected ')') shows me the exact same thing.
Double clicking on error 5 (In Object obj_reeroomer, in Event StepNormalEvent action number 1 at line 1 : Assignment operator expected) shows me this (and yes, the Execute Script did not reference a script in Game Maker for Mac either. I tried to get rid of the error by removing this rule (since I don't think it does anything, but I really can't remember) but that changed nothing):
3.png
Double clicking on error 6 (In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ',' or ')') shows me this (there are just a bunch more "Display a message" rules further down the script):
4.png
Double clicking on error 7 (In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ')') shows me the exact same thing.
Double clicking on error 8 (In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ',' or ')') shows me this (there are just a bunch more "Display a message" rules further down the script):
5.png
Double clicking on error 9 (In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ')') shows me the exact same thing.
Double clicking on error 10 (In Object obj_reeroomer, in Event StepNormalEvent action number 1 at line 1 : malformed assignment statement) shows me this (and yes, the Execute Script did not reference a script in Game Maker for Mac either. I tried to get rid of the error by removing this rule (since I don't think it does anything, but I really can't remember) but that changed nothing) I can't add any more pics to this reply, I'll post it in the next reply.
 

Sharadise

Member
6.png
Double clicking on error 11 (In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement) shows me this (again, there are just a bunch more "Display a message" rules further down the script):
7.png
Double clicking on error 12 (In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement) shows me this (there are just 2 more "Display a message" rules further down the script):
8.png

I hope this is what you requested (sorry if you wanted me to upload something different).
 

FrostyCat

Member
For the undefined script actions, change them back to the script that they were supposed to be running (and add it back if it had an invalid name and was lost during the import), or get rid of them.

For the other ones that say line 18 or 20, they seem to be close to the Display a Message actions. It could be the case that the message contains GML reserved characters and GMS 1.4 is getting confused by them. Try replacing those actions with their GML equivalents using Execute Code actions. The function for showing a blocking message is show_message.

Once you've made the replacements, run Scripts > Check All Scripts to verify the project, clear your compile cache with Run > Clean Build, and try building again.
 

Sharadise

Member
For the undefined script actions, change them back to the script that they were supposed to be running (and add it back if it had an invalid name and was lost during the import), or get rid of them.

For the other ones that say line 18 or 20, they seem to be close to the Display a Message actions. It could be the case that the message contains GML reserved characters and GMS 1.4 is getting confused by them. Try replacing those actions with their GML equivalents using Execute Code actions. The function for showing a blocking message is show_message.

Once you've made the replacements, run Scripts > Check All Scripts to verify the project, clear your compile cache with Run > Clean Build, and try building again.
I've done as you've suggested.
Check all Scripts reveals no errors, but when I try to run the game I still get these errors:
Code:
    In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ',' or ')'
    In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : got 'Mushroom' expected ')'
    In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ',' or ')'
    In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : got 'Electronics' expected ')'
    In Object obj_mushroom_parts, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement
    In Object obj_electronics, in Event LeftButtonReleased action number 1 at line 18 : malformed assignment statement
    Compile Failed - Please check the Compile window for any additional information
I've noticed that all the objects that are throwing these errors contain "Check Question" rules. Should I replace them with something else as well?
 

FrostyCat

Member
Then replace the Check Question actions with the Check Expression action. The equivalent expression is show_question(message).
Code:
show_question("Do you like green eggs and ham?")
Code:
show_question("Do you like green eggs and " + global.food + "?")
Code:
show_question("Pay $" + string(global.price) + " for green eggs and ham?")
 

Sharadise

Member
Then replace the Check Question actions with the Check Expression action. The equivalent expression is show_question(message).
Code:
show_question("Do you like green eggs and ham?")
Code:
show_question("Do you like green eggs and " + global.food + "?")
Code:
show_question("Pay $" + string(global.price) + " for green eggs and ham?")
Can I just put the new question code in an Execute Code rule in place of the Check Question rule in the same drag and drop structure? Or do I need to put the things that happen when the question is answered with Yes or No in the Execute Code rule as well?
 

FrostyCat

Member
Can I just put the new question code in an Execute Code rule in place of the Check Question rule in the same drag and drop structure? Or do I need to put the things that happen when the question is answered with Yes or No in the Execute Code rule as well?
I meant using this action:

The Manual entry said:
Test Expression
This is the most general question action whereby you can enter an arbitrary expression and evaluate it. If the expression evaluates to true (that is, a number larger or equal to 0.5) then the next action (or block of actions) is performed. For more information on expressions see this section of the manual - Using Expressions and Variables in Actions.
 

Sharadise

Member
This woks! The game now runs perfectly, Thanks!
After fixing all the errors that showed up when I do Check All Scripts I imported the next project into GMS 1.4.
I get no errors upon importing, or when I do Check All Scripts or Check Resource Names, but when I try to run the game I get whole bunch of errors seemingly related to the "Check Object" drag and drop rule, the "Test Chance" rule, the "Check Empty" rule, and maybe a "Create Instance" or "Set Alarm" rules.
Here's the error log:
Code:
    In Object SilverRock, in Event CreateEvent action number 15 at line 8 : unexpected symbol "," in expression
    In Object SilverRock, in Event CreateEvent action number 15 at line 8 : got '-' expected ')'
    In Object SilverRock, in Event CreateEvent action number 15 at line 8 : wrong number of arguments for function action_create_object
    In Object SilverRockOn, in Event StepNormalEvent action number 1 at line 9 : unexpected symbol "," in expression
    In Object SilverRockOn, in Event StepNormalEvent action number 1 at line 9 : got '-' expected ')'
    In Object SilverRockOn, in Event StepNormalEvent action number 1 at line 9 : wrong number of arguments for function action_create_object
    In Object SilverRock_pass, in Event CreateEvent action number 15 at line 8 : unexpected symbol "," in expression
    In Object SilverRock_pass, in Event CreateEvent action number 15 at line 8 : got '-' expected ')'
    In Object SilverRock_pass, in Event CreateEvent action number 15 at line 8 : wrong number of arguments for function action_create_object
    In Object SilverRock_pass_On, in Event StepNormalEvent action number 1 at line 9 : unexpected symbol "," in expression
    In Object SilverRock_pass_On, in Event StepNormalEvent action number 1 at line 9 : got '-' expected ')'
    In Object SilverRock_pass_On, in Event StepNormalEvent action number 1 at line 9 : wrong number of arguments for function action_create_object
    In Object Spark, in Event CreateEvent action number 3 at line 18 : Number 0.1.5 in incorrect format
    In Object SilverRock_delayer, in Event ObjAlarm0 action number 4 at line 1 : unexpected symbol "," in expression
    In Object SilverRock_delayer, in Event ObjAlarm0 action number 4 at line 1 : got '-' expected ')'
    In Object SilverRock_delayer, in Event ObjAlarm0 action number 4 at line 1 : wrong number of arguments for function action_create_object
    In Object SilverRock_delayer_On, in Event StepNormalEvent action number 1 at line 9 : unexpected symbol "," in expression
    In Object SilverRock_delayer_On, in Event StepNormalEvent action number 1 at line 9 : got '-' expected ')'
    In Object SilverRock_delayer_On, in Event StepNormalEvent action number 1 at line 9 : wrong number of arguments for function action_create_object
    In Object Pulser, in Event ObjAlarm0 action number 4 at line 1 : unexpected symbol "," in expression
    In Object Pulser, in Event ObjAlarm0 action number 4 at line 1 : got '-' expected ')'
    In Object Pulser, in Event ObjAlarm0 action number 4 at line 1 : wrong number of arguments for function action_create_object
    In Object Obsidian_dust, in Event CreateEvent action number 17 at line 26 : unexpected symbol "," in expression
    In Object Obsidian_dust, in Event CreateEvent action number 17 at line 26 : got '-' expected ')'
    In Object Obsidian_dust, in Event CreateEvent action number 17 at line 26 : wrong number of arguments for function action_create_object
    Compile Failed - Please check the Compile window for any additional information
Do I need to replace these rules as well (like the show message/show question rules)?
 

FrostyCat

Member
Once again, you need to use Check Resource Names and fix all the fancy names before trying to import into GMS 1.4, not after.

I'm not sure what's going wrong, but it's probably because of special characters (e.g. commas, spaces, dashes, etc.) in action parameters that are being misinterpreted as GML. Go through any actions you see containing these in any text field, and replace them with their GML equivalents.
 

Sharadise

Member
Once again, you need to use Check Resource Names and fix all the fancy names before trying to import into GMS 1.4, not after.

I'm not sure what's going wrong, but it's probably because of special characters (e.g. commas, spaces, dashes, etc.) in action parameters that are being misinterpreted as GML. Go through any actions you see containing these in any text field, and replace them with their GML equivalents.
Thanks for the quick response!

I did use Check Resource Names and applied any fixes before I imported into GMS 1.4. When I check after the import it states <No name conflicts were found>, I'm sorry I didn't make it clear when writing before. I'll start replacing the actions with the GML equivalents (though I cannot find invalid names anywhere).

Thanks for being patient with me, I really appreciate all the help.

I'm trying to replace the actions with the GML equivalents like you said, but how would I find the object's position to add to (simulating the 'Relative' checkbox on the Check Object and Check Empty actions)? Would it be something like this inside a Test Expression action with 'NOT' ticked (instead of a Check Empty action with a position of 0, 0 and NOT ticked):
Code:
place_free(instance.position.x, instance.position.y)
I'm trying to replace the actions with the GML equivalents like you said, but how would I find the object's position to add to (simulating the 'Relative' checkbox on the Check Object and Check Empty actions)? Would it be something like this inside a Test Expression action with 'NOT' ticked (instead of a Check Empty action with a position of 0, 0 and NOT ticked):
Code:
place_free(instance.position.x, instance.position.y)
Is it just:
Code:
place_free(x, y)
?
 

FrostyCat

Member
Example 1: Check not empty (3, 5) relative, all:
Code:
!place_empty(x+3, y+5)
Example 2: Check empty (4, 6) relative, solid:
Code:
place_free(x+4, y+6)
 

Sharadise

Member
I've replaced all the Check Object, Check Empty and Create Instance actions that the errors were showing me when double clicking on them with Test Expression actions that contain the GML equivalent, but I can't find the GML equivalent of the Test Chance action (I've searched in the manual but couldn't find anything). Please what is the GML equivalent for this?

Many thanks for all the help!
 

Sharadise

Member
"Test Expression", same as the one on post #19.
I've now replaced the Test Chance action as well, but every error still persists when I try to run the game. The only difference being that the errors now open up the Test Expression actions instead of the original DnD actions. And yet Check Resource Names & Check All Scripts still says that everting's OK. Am I missing something?
 

FrostyCat

Member
Ignore the line numbers for now and just check the whole event for problems. The last time you showed me one of those errors, the cause was on a different line, so there's a ripple effect going on.

Also, start posting the object information where you're getting errors from. You can get that from the Show Information button at the bottom-left corner of the Object Properties window.
 

Sharadise

Member
Ignore the line numbers for now and just check the whole event for problems. The last time you showed me one of those errors, the cause was on a different line, so there's a ripple effect going on.

Also, start posting the object information where you're getting errors from. You can get that from the Show Information button at the bottom-left corner of the Object Properties window.
I've looked through the event of the first error (and the "Information About:" report) and I cannot find anything invalid.
Maybe I'm missing something (like before with "power"). Here's that first error:
Code:
In Object SilverRock, in Event CreateEvent action number 15 at line 8 : unexpected symbol "," in expression
And here's that object's information (from clicking Show Information on the object that the first error linked me to):
Code:
Information about object: SilverRock
Sprite: spr_SilverRock
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

if number of objects obj_RPL is larger than 0
      blend the sprite with color 16711934 and alpha value 1
else
if number of objects NormalL is larger than 0
      blend the sprite with color 16777215 and alpha value 1
else
if expression place_meeting(x, y, NO_PLACING) is not true
      create instance of object SilverRockoffmaker at relative position (-50,0)
      create instance of object SilverRockoffmaker at relative position (50,0)
      create instance of object SilverRockoffmaker at relative position (0,50)
      create instance of object SilverRockoffmaker at relative position (,-50)
      align position to a grid with cells of 50 by 50 pixels
      if at relative position (0,0) there is object Gravel
            create instance of object Rock_pickup at relative position (25,25)
            destroy the instance
      else
      if at relative position (0,0) there is object Wood_raw
            create instance of object Rock_pickup at relative position (25,25)
            destroy the instance
      else
      if at relative position (0,0) there is object Wood
            create instance of object Rock_pickup at relative position (25,25)
            destroy the instance
      else
      if at relative position (0,0) there is object Stick
            create instance of object Rock_pickup at relative position (25,25)
            destroy the instance
      else
else
      destroy the instance
Step Event:

if at relative position (0,-26) there is object Lapis_Lazuli_Switch_on
      create instance of object SilverRockonmaker at relative position (-50,0)
      create instance of object SilverRockonmaker at relative position (50,0)
      create instance of object SilverRockonmaker at relative position (0,50)
      create instance of object SilverRockonmaker at relative position (0,-50)
      destroy the instance
      create instance of object SilverRockOn at relative position (0,0)
else
Collision Event with object SilverRockonmaker:

destroy the instance
create instance of object SilverRockOn at relative position (0,0)
Mouse Event for Left Pressed:

if global.active is equal to 11
      if global.sandstonepickaxe is greater than 0
            destroy the instance
            create instance of object SilverRock_pickup at relative position (0,0)
      else
else
Other Event: Outside Room:

destroy the instance

Again, many thanks!
 

Sharadise

Member
Thanks! I didn't realise GMS 1.4 no longer defaulted to 0.
Edit: I'll check whether I have made the same mistake anywhere else.
Thank you! That fixed most the errors. I now only have 1 error remaining in this project when try to run the game. Here's the implicated object's info (if that helps):
Code:
Information about object: Spark
Sprite: spr_Misc
Solid: false
Visible: false
Depth: 0
Persistent: false
Parent: 
Children: 
Mask: 

No Physics Object
Create Event:

scale the sprite with 0.2 in the xdir, 0.2 in the ydir, rotate over 0, and no mirroring
start moving in directions 101101101 with speed set to 12
if expression random(2) < 1 is true
      set the gravity relative to 0.2 in direction 0
else
      set the gravity relative to 0.1.5 in direction 0
Step Event:

create a small effect of type spark relative at (0,0) of  color 9959935 above objects
Collision Event with object Wood_raw:

destroy the instance
Collision Event with object Wood:

destroy the instance
Collision Event with object Stick:

destroy the instance
Collision Event with object Gravel:

destroy the instance
Collision Event with object Gravel_Grass:

destroy the instance
Collision Event with object Rock:

destroy the instance
Collision Event with object Rock_Grass:

destroy the instance
Collision Event with object Sand:

destroy the instance
Collision Event with object Sand_grass:

destroy the instance
Collision Event with object SilverRock:

destroy the instance
Collision Event with object SilverRockOn:

destroy the instance
Collision Event with object Coal:

destroy the instance
Collision Event with object Glass_block:

destroy the instance
Collision Event with object Glass_light:

destroy the instance
Collision Event with object Lapis_Lazuli:

destroy the instance
Collision Event with object Dirt:

destroy the instance
Collision Event with object Dirt_Grass:

destroy the instance
Collision Event with object Mossy_stone_brick:

destroy the instance
Collision Event with object Mossy_stone_brick_grass:

destroy the instance
Collision Event with object Mossy_stone_brick_grass_2:

destroy the instance
Collision Event with object Coal_brick:

destroy the instance
Collision Event with object Coal_brick_grass:

destroy the instance
Collision Event with object Clay:

destroy the instance
Collision Event with object Clay_brick:

destroy the instance
Collision Event with object Clay_brick_grass:

destroy the instance
Collision Event with object Sand_brick:

destroy the instance
Collision Event with object Sand_brick_grass:

destroy the instance
Collision Event with object Lapis_Lazuli_Brick:

destroy the instance
Collision Event with object Ruby_Rock:

destroy the instance
Collision Event with object Obsidian:

destroy the instance
Collision Event with object Bedrock:

destroy the instance
Collision Event with object Raw_Gold:

destroy the instance
Collision Event with object Raw_Gold_grass:

destroy the instance
Collision Event with object Block_of_Gold:

destroy the instance
Collision Event with object Block_of_Gold_grass:

destroy the instance
Collision Event with object Gold_brick:

destroy the instance
Collision Event with object Gold_brick_grass:

destroy the instance
Collision Event with object SilverRock_delayer:

destroy the instance
Collision Event with object SilverRock_delayer_On:

destroy the instance
Collision Event with object Pulser:

destroy the instance
Collision Event with object Miner:

destroy the instance
Other Event: Outside Room:

destroy the instance
I don't know what could be wrong as "Check All Scripts" still tells me that there are no errors, and that everything's OK.
Maybe it's another piece of syntax that the previous version of GM allowed, but 1.4 doesn't?
 

FrostyCat

Member
This is your problem:
Code:
set the gravity relative to 0.1.5 in direction 0
Next time the compiler complains about invalid syntax, don't just post it here for me to look at, use the Show Information button and look for unusual content.
 

Sharadise

Member
This is your problem:
Code:
set the gravity relative to 0.1.5 in direction 0
Next time the compiler complains about invalid syntax, don't just post it here for me to look at, use the Show Information button and look for unusual content.
Ah... Sorry, I didn't know GMS 1.4 no longer allowed 'double decimal point' syntax (I used it a lot in Game Maker for Mac as it helped me visualise the numbers better). Now that I'm aware of this change I will do my best to fix syntax issues like this before posting.

Many thanks!
 

Sharadise

Member
Ah... Sorry, I didn't know GMS 1.4 no longer allowed 'double decimal point' syntax (I used it a lot in Game Maker for Mac as it helped me visualise the numbers better). Now that I'm aware of this change I will do my best to fix syntax issues like this before posting.

Many thanks!
Now that all the errors have been fixed in GMS 1.4, I've imported a copy of the project into GMS 2. I'm only getting errors about a script called "action_if_mouse.gml". As far as I can remember I've never created such a script, so I'm assuming this a a compatibility script created by GMS 2 while importing the GMS 1.4 project to replace a DnD action? The errors say this:
Code:
Script: action_if_mouse at line 9 : unknown function or script mouse_button_released
Script: action_if_mouse at line 3 : unknown function or script mouse_button_released
Script: action_if_mouse at line 9 : unknown function or script mouse_button_down
Script: action_if_mouse at line 3 : unknown function or script mouse_button_down
This is the content of the "action_if_mouse.gml" script:
Code:
/// @description (Old DnD) - if mouse evauation
/// @param button    button to check
var ret = mouse_button_down(argument0) || mouse_button_released(argument0);
switch( argument0 )
{
    case 1:   
    case 2:   
    case 3:
        ret = mouse_button_down(argument0) || mouse_button_released(argument0);
        break;
    default:
        ret = (mouse_button == 0);
        break;   
} // end switch
return ret;
I've tried searching for a solution online, but I couldn't find anyone that had already posted about this.
How do I tell Game Maker what I'm assuming are functions (again, sorry but it's been many years since I've used GML) "mouse_button_down" and "mouse_button_released" are (as it seems to be confused about this)?

Many thanks for all the help, I really do appreciate your patience with me.
 

FrostyCat

Member
That's odd, looks like YoYo messed up their compatibility scripts. The standard names are mouse_check_button() (for down), mouse_check_button_pressed() and mouse_check_button_released().
 

Sharadise

Member
Thanks! Though I'm not quite sure how to fix the script using the code you've given me. I thought that if it's just the names of the functions that are wrong I could maybe just replace them with what you've given me (I should have known it wouldn't be that simple), so I've replaced the mouse_button_down(argument0), and mouse_button_released(argument0) parts with the code you've provided, but it just gives me a 2 "unexpected unary operator || " errors and 2 "unexpected syntax error" errors.

Please, how should I correctly use the code excerpts you've given me?
 

FrostyCat

Member
Code:
/// @description (Old DnD) - if mouse evauation
/// @param button    button to check
var ret = mouse_check_button(argument0) || mouse_check_button_released(argument0);
switch( argument0 )
{
   case 1:   
   case 2:   
   case 3:
       ret = mouse_check_button(argument0) || mouse_check_button_released(argument0);
       break;
   default:
       ret = (mouse_button == 0);
       break;   
} // end switch
return ret;
 

Sharadise

Member
Thanks! That's fixed the issue.
The game runs now, but I'm getting a lot of syntax error seemingly about a global variable I have called "global.active".
Is the variable name "active" illegal in newer versions of GM (the way that "power" is)?
 

FrostyCat

Member
The next time you aren't sure if a name is taken by something built-in, use the Index tab in the Manual to find out. active is not on there.

Another source of name conflicts is your resource tree. Press Ctrl+T in GMS 2 and type active there to see if you have anything named that.

And syntax errors don't always report the actual source of the violation, sometimes it's a cascading effect starting somewhere else. Try looking upstream instead of fixating on the one line where the error comes from.
 

Sharadise

Member
Thanks for letting me know where I can look those up, that's very helpful!

The thing is, there really isn't anything upstream of where these errors are pointing to.
Every single one of my syntax errors points to one of my "icon objects" (an object that just serves as a UI button):
Object > Events > Left Released/Event: Left Pressed >
Code:
 var global.active = *some integer value*
Could this be related to the "action_if_mouse" compatibility script from before?

Here are all the syntax error messages (as you can see they are all pointing to "Event: Left Released" or "Event: Left Pressed"):
Code:
furnace_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
furnace_icon_i Event: Left Released at line 1, 11 : variable global only referenced once
moojim_seed_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
obsidian_dust_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
coal_icon Event: Left Pressed at line 1, 12 : unexpected syntax error
lapislazuliswitch_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
tune_box_a_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
block_of_gold_icon Event: Left Released at line 1, 12 : unexpected syntax error
presureplatewoodone_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
squarebucket_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
coal_brick_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
all_pickup_conveyer_left_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
tune_box_b_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
sand_icon Event: Left Released at line 1, 12 : unexpected syntax error
vine_icon Event: Left Released at line 1, 12 : unexpected syntax error
wood_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
bedrock_icon Event: Left Released at line 1, 12 : unexpected syntax error
gravel_icon Event: Left Released at line 1, 12 : unexpected syntax error
silverrock_delayer_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
sandstoneaxe_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
gold_brick_icon Event: Left Released at line 1, 12 : unexpected syntax error
tourch_1_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
ruby_icon Event: Left Released at line 1, 12 : unexpected syntax error
lapislazuli_icon Event: Left Released at line 1, 12 : unexpected syntax error
dirt_icon Event: Left Released at line 1, 12 : unexpected syntax error
obsidian_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
dungbeetle_o_icon Event: Left Released at line 1, 12 : unexpected syntax error
stick_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
rock_icon Event: Left Released at line 1, 12 : unexpected syntax error
moojim_fruit_icon Event: Left Released at line 1, 12 : unexpected syntax error
silverrock_pass_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
all_pickup_conveyer_down_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
all_pickup_conveyer_up_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
sand_brick_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
silverrock_icon Event: Left Released at line 1, 12 : unexpected syntax error
bed_rp_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
grass_icon Event: Left Released at line 1, 12 : unexpected syntax error
water_icon Event: Left Released at line 1, 12 : unexpected syntax error
all_pickup_conveyer_right_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
clay_brick_icon Event: Left Released at line 1, 12 : unexpected syntax error
scissors_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
pusher_plate_wood_one_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
lapis_lazuli_brick_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
ruby_axe_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
clay_icon Event: Left Released at line 1, 12 : unexpected syntax error
glass_block_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
grass_seed_icon Event: Left Released at line 1, 12 : unexpected syntax error
ledder_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
pulser_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
pickupspawner_icon_i Event: Left Released at line 1, 12 : unexpected syntax error
string_o_icon Event: Left Released at line 1, 12 : unexpected syntax error
I would also attach the "Object Information" of one of the affected objects, but I'm not sure where to find that in GMS 2.
 

FrostyCat

Member
Don't use var with the global or instance scope. Do this and leave it at that.
Code:
global.active = 0;
Make sure you understand the role of the 3 basic variable scopes. var is for local scope only, and global is for global scope only.
  • Local scope is for temporary values.
  • Instance scope is for individual properties of object instances.
  • Global scope is for shared, singular properties of the environment.
Having a full grasp of scope enables you to keep apart values that should be kept apart, and that starts by using proper scoping syntax.
 

Sharadise

Member
I've started updating the next project to GMS 1.4, and I've been able to fix most errors with the information you've given me but I do have one question: what is the replacement for the "Sleep" action in GMS 1.4?

Many thanks!
 

FrostyCat

Member
Sleep has been removed since GMS 1 because modern operating systems show "app not responding" error messages for waits that block the runner. If at all possible, use an alarm instead of a blocking wait. See this topic for an older discussion on this.
 

Sharadise

Member
I've now been able to successfully upgrade all my old projects to current Game Maker versions thanks to all your kind help.
Thank you!
 
Top