GameMaker I'm having trouble with the SMA1 bubble thing for Hello Mario Engine

Status
Not open for further replies.
G

gohkenytp

Guest
I was trying to port the SMA1 bubble thing (from SuperArthurBros's fanamde Hello Mario Engine) to Game Maker Studio but everytime I do it, it causes errors. Does anyone know about this?

Here's the code:
GML:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_solidbubble:

Variable obj_solidbubble.<unknown variable>(100224, -2147483648) not set before reading it.
 at gml_Object_obj_solidbubble_CreateEvent_1 (line 2) - if obj_solidbubble.item = 0
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_solidbubble_CreateEvent_1 (line 2)
 

TheouAegis

Member
The error message is telling you that you are trying to read the variable item before it has been setto anything. I am guessing this is a code from gm8 or gm7, back when you could get away with not declaring variables.
That won't work in Studio. You need to first declare a variable and set it to some value. And it is weird that the object which is supposed to contain the variable is being checked if its variable has been set. In those situations, I think it is implied that you need to set the variable in the Instance Creation Code in the room (which still strikes me as odd).
 
G

gohkenytp

Guest
The error message is telling you that you are trying to read the variable item before it has been setto anything. I am guessing this is a code from gm8 or gm7, back when you could get away with not declaring variables.
That won't work in Studio. You need to first declare a variable and set it to some value. And it is weird that the object which is supposed to contain the variable is being checked if its variable has been set. In those situations, I think it is implied that you need to set the variable in the Instance Creation Code in the room (which still strikes me as odd).
Well how do I do that?
 

TheouAegis

Member
item=0

If obj_solidbubble is placed in the room manually, click on it and then click the button for Creation Code, then put that line in.
 
G

gohkenytp

Guest
Ok, if you say so.
GML:
if item = 0
    item = 1
ready = 0
ready2 = 0
ready3 = 0
image_speed = 0
zoom = 1
maskzoom = 1
mysolid = instance_create(x,y-16,obj_solid)
mysolid.sprite_index = spr_solidbubblemask
Code:
ready = 2
ready3 = 0
alarm[1] = 10
Code:
ready = 1
alarm[2] = 10
Code:
ready = 2
alarm[3] = 10
Code:
ready = 1
alarm[4] = 10
Code:
ready = 0
Code:
if ready = 1
{
    zoom -= 0.06
    y += 1
}
else if ready = 2
{
    zoom += 0.06
    y -= 1
}
if ready3 = 1
    maskzoom -= 0.06
mysolid.image_yscale = maskzoom
mysolid.image_xscale = maskzoom
mysolid.y = y-16*zoom
Code:
if other.held = 1
and ready = 0
{
    if ready2 = 2
    {
        if item = 1
        {
            ID = instance_create(x-8,y-8,obj_grasspowerup)
            ID.hspeed = obj_mario.direct
            with ID sprite_index = spr_mushroom
        }
        if item = 2
        {
            ID = instance_create(x-8,y-8,obj_grasspowerup)
            ID.hspeed = obj_mario.direct
            with ID sprite_index = spr_1up
        }
        if item = 3
            instance_create(x-8,y-16,obj_acecoin)
        instance_create(x-8,y-8,obj_smoke)
        with mysolid instance_destroy()
        instance_destroy()
    }
    sound_play(snd_vine)
    other.vspeed = -3
    ready = 1
    ready2 += 1
    ready3 = 1
    alarm[0] = 5
}
Code:
if item = 3
    draw_sprite_ext(sprite_index,item,x,y,zoom,zoom,0,c_white,1)
else
    draw_sprite(sprite_index,item,x,y)
draw_sprite_ext(sprite_index,0,x,y,zoom,zoom,0,c_white,1)
 
If you're using GMS2, you'll need to make adjustments to the codes since it was originally made using GMS1. For example at a quick glance I noticed you have mysolid = instance_create(x,y-16,obj_solid); where instance_create(x, y, obj) is no longer in use in GMS2. You'll have to either edit and use instance_create_layer(x, y, layer, obj) or instance_create_depth(x, y, depth, obj). There are likely more of such obsolete codes that you'll need to revise to function in the new IDE. For that you need to refer to the Manual.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Seems like you haven't learned a thing since our first interaction.

You're still trying to retrieve the value of a variable that you didn't declare yet. Seven months later. ;)


You're not declaring, and therefore setting the value of, item anywhere. At least not anywhere before another part of your code tries to get its value, which it doesn't have, because it doesn't exist, because you didn't declare it, because you didn't assign a value to it.
 
G

gohkenytp

Guest
If you're using GMS2, you'll need to make adjustments to the codes since it was originally made using GMS1. For example at a quick glance I noticed you have mysolid = instance_create(x,y-16,obj_solid); where instance_create(x, y, obj) is no longer in use in GMS2. You'll have to either edit and use instance_create_layer(x, y, layer, obj) or instance_create_depth(x, y, depth, obj). There are likely more of such obsolete codes that you'll need to revise to function in the new IDE. For that you need to refer to the Manual.
Honestly, I'm using GMS1. Not GMS2.
 
G

gohkenytp

Guest
I forgot that I'm posting the topic in the wrong section. But I'm talking about making a solid bubble from SMA1 to Hello's Mario Engine on Game Maker Studio 1.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Did you also forget that you personally received multiple replies with solutions to this issue seven months ago, that you were reminded of this four hours ago and even had the solution spelt out again, leaving absolutely no way for us to make this any easier for you, then proceeded to ignore it?

You've had multiple extraordinarily helpful people, both in this topic and all of your other topics, trying their best to explain things to you in the easiest to understand way possible... it's not that we don't want to help you, but there is only so much we can do for you. We can't do everything for you and lay it out on a silver platter as well. This is a support forum for developers, not lazybones, and I'm afraid you're still not putting in the required effort after all this time. If you want people to fix your stuff for you, post a topic in the Collaboration forum and pay someone to do it.

I believe we're done here, so I'll lock this topic. To pick up where we left off seven months ago, all further topics that have little to no effort put both into researching and resolving the problem as well as describing the problem in the topic will be deleted, not locked.
 
Status
Not open for further replies.
Top