Need help with collisions

Hi, i just started using game maker, very uneducated in it but im trying to learn, and follow along with a tutorial for a game i want to make myself (using the tutorial to learn). I have followed everything done in this video
(
) and as far as im aware, my scripts are identical to his, but for some reason they arent working, i will post them down below

For the player:

"switch (state)
{
case "move":
#region move state
if keyboard_check(vk_right) and not place_meeting(x+4, y, o_wall) X
{
x += 4; <-------------------- in the tutorial he puts the name of this script on this line
image_xscale = 1;
sprite_index = s_skeleton_run_strip6;
image_speed = 0.6;
}

if keyboard_check(vk_left) and not place_meeting(x-4, y, o_wall)
{
x -=4; <-------------------- in the tutorial he puts the name of this script on this line as well
image_xscale = -1;
sprite_index = s_skeleton_run_strip6;
image_speed = 0.6;
}

if not keyboard_check(vk_right) and not keyboard_check(vk_left)
{
sprite_index = s_skeleton_idle_strip3;
image_speed = 0.4;
}

if keyboard_check_pressed(vk_space)
{
image_index = 0;
state = "roll";
}

if keyboard_check_pressed(vk_lshift)
{
image_index = 0;
state = "attack one"
}
#endregion
break;

case "roll":
#region roll state
sprite_index = s_skeleton_roll_strip7;
image_speed = 0.6;

if image_xscale == 1 and not place_meeting(x+4, y, o_wall)
{
x += 6;
}

if image_xscale == -1 and not place_meeting(x-4, y, o_wall)
{
x -= 6;
}
#endregion
break;

case "attack one":
#region attack one state
sprite_index = s_skeleton_attack_one_strip5
image_speed = 0.6
#endregion
break;
}"

And for the script:
"if not place_meeting(x+argument0, y, o_wall)
{
x += argument0;
}

if not place_meeting(x, y+argument0, o_wall)
{
y += argument1;
}"

AND NOW for my error message:
"############################################################################################
ERROR in
action number 1
of Create Event
for object <undefined>:

Variable <unknown_object>.y(1, -2147483648) not set before reading it.
at gml_GlobalScript_Script1 (line 1) - if not place_meeting(x+argument0, y, o_wall) <------------------------------------------- like its not picking up my y variable, ive also tried position_meeting but that doesnt work either
############################################################################################
gml_GlobalScript_Script1 (line 1)"


Please, help me!
 

FrostyCat

Redemption Seeker
You are using syntax from a pre-2.3 tutorial in a post-2.3 version of GMS. This is a bad idea, especially if you are completely new.
Drop that tutorial and instead begin with an up-to-date tutorial from this page. Once you have a good understanding of how the engine and language works, you can decide for yourself how to adapt legacy code to current standards.
 
You are using syntax from a pre-2.3 tutorial in a post-2.3 version of GMS. This is a bad idea, especially if you are completely new.
Drop that tutorial and instead begin with an up-to-date tutorial from this page. Once you have a good understanding of how the engine and language works, you can decide for yourself how to adapt legacy code to current standards.
Firstly thank you SO much, and yeah im completely new, i am trying to put together the script to be able to get rid of the lines of code he did in the video, and make a script for the collision interaction as well. im just confused on what to put where, sorry for being like seriously nooby, i am trying my hardest however.
 

FrostyCat

Redemption Seeker
This is what the new syntax looks like for the move_and_collide script function from the tutorial:
GML:
function move_and_collide(xsp, ysp)
{
    if not place_meeting(x+xsp, y, o_wall)
    {
        x += xsp;
    }

    if not place_meeting(x, y+ysp, o_wall)
    {
        y += ysp;
    } 
}
If you aren't going to update the syntax yourself, then save yourself the trouble and stop using that tutorial. Otherwise, you're bound to see more of this crap down the line and get needlessly confused.
 
This is what the new syntax looks like for the move_and_collide script function from the tutorial:
GML:
function move_and_collide(xsp, ysp)
{
    if not place_meeting(x+xsp, y, o_wall)
    {
        x += xsp;
    }

    if not place_meeting(x, y+ysp, o_wall)
    {
        y += ysp;
    }
}
If you aren't going to update the syntax yourself, then save yourself the trouble and stop using that tutorial. Otherwise, you're bound to see more of this crap down the line and get needlessly confused.
I am beginning to see how it works kind of, just need somewhere to start, i just downloaded game maker yesterday but i have SOME prior knowledge, thank you so much for your help
 
The point is, don't use this tutorial. By now, there's enough up-to-date tutorials to get you started.
Don't just follow this one because you like the graphics, or whatever, you're literally shooting yourself in the foot by doing so.
By missing on cool new features AND by learning broken syntax.
 
Top