• 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!

with command

Status
Not open for further replies.
Hi. I have the following code:

+
GML:
    inst = instance_create(300, 371, SentryBatWalkMap);
    with (inst)
    {
        path_start(Path53, 5, path_action_stop, 0);
        show_debug_message("Spacing myTimer:" + string(global.spacing_myTimer));
        show_debug_message("Path Position: " + string(path_position));
        path_position = global.spacing_myTimer;
        show_debug_message("Updated path_position" + string(path_position));
        path_end();
    }
I want to make the SentryBatWalkMap character to follow a path. The problem is the with(inst) i think. I keep getting an error thrown. I commented it out and then ran it again and below
path_start, the show_debug_message portion crashed. Is it because of the with(inst) when inst is an instance not an object?

(edit)

This is the error:

GML:
___________________________________________
############################################################################################
ERROR in
action number 1
of  Step Event0
for object TravelMasterbk:

invalid with reference
 at gml_Object_TravelMasterbk_Step_0 (line 52) -               path_start(Path54, 5, path_action_stop, 0);
############################################################################################
gml_Object_TravelMasterbk_Step_0 (line 52)
 

kburkhart84

Firehammer Games
1. Are you using GMS before version 2? Otherwise, that instance_create() function won't be right.

2. Can you confirm that "SentryBatWalkMap" is the name of an object, correctly written?

3. If you comment out the whole part inside the brackets of the with() statement, do you still get an error? If so, is it the same?
 

TsukaYuriko

☄️
Forum Staff
Moderator
You already have a topic about this, so I'll close this one as more than one topic discussing the same issue is not allowed.


You've already been instructed not to post duplicate topics multiple times by now, mostly via alerts or in private messages, so this time I'll do it publicly and next time (which hopefully won't happen) is going to be a warning and/or account restrictions. We can't and won't chase after your trail of duplicates forever, so please stop before we run out of patience for the sake of everyone involved.
 
Status
Not open for further replies.
Top