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

quick questione~

Le_Beholder

Member
not sure if this belongs in programming forums, but anyhow.
anyone know the GameMaker 8.0 equivalent for the Studio function ++ , -- , == ?

I Think ++ can be retro translated back to v += 1 or something..
anyone know?
 

FrostyCat

Redemption Seeker
v++ can be roughly translated back to 8.0-era GML as this (roughly because the translated version doesn't return a value):
Code:
v += 1;
In the same vein, v-- can also be roughly translated back to 8.0-era GML as this:
Code:
v -= 1;
== has always been part of GML since day one, so I don't know why you think that needs adaptation.
 

Le_Beholder

Member
thanks. now i have to figure out why a heart container count is showing all 16 instead of one at a time with the original code... literally all i changed was the i++ to i+=1

sigh. i think i'll have to upgrade to studio 2 next paycheck :/
nobody seems to support 8.0 anymore :(
 

CloseRange

Member
the general code is about the same. If you show the code we are always happy to help even with 8.0 code.
The general idea of programming is still the same and a lot of us have been around for 8.0 and still know it.

If all you changed was i++ to i+=1 and there is nothing more to that code then something else is going on.
 

Le_Beholder

Member
Alrighty,
Code:
If (instance_exists(obj_player))
{
xt = 944;
yt = 215;
for (i = 0; i < obj_player.hp_containers; i += 1)//<- this part I changed from i++
ht_index = 0;
if (i > 7)
{
xt = 880;
yt = 206;
}
if (player.hp >= (i+1)*8)
{
ht_index = 2;
{
else if (obj_player.hp >= (i+.5)*8)
{
ht_index = 1;
}
draw_sprite_ext(spr_hearts,ht_index,xt+I*8,yt,1,1,0,c_white,1)
}
}
That's the code that draws hearts zelda-style in the area of the overworld I use for hud. It's supposed to only draw one extra heart at a time when I pick up a heart container, and just cycles their images to indicate player damage.
But since I turned that i++ into i+=1, it draws all the maximum hearts when I pick up just one container...
Weird.
 

TheouAegis

Member
The only difference is i++ can be used inline.

repeat 10 { y=i++;}

Would need to be

repeat 10 { y=i; i+=1;}

And ++i is a whole other matter. You need to increase BEFORE reading.

repeat 10 y=++i

would become

repeat 10 {i+=1; y=i;}
 
H

Homunculus

Guest
That code is giving me a headache... Why is i sometimes referred as I (uppercase)? Anyways, I see a for loop without braces, you probably need those. The ++ part is just fine, it's not the issue here.
 

Le_Beholder

Member
That code is giving me a headache... Why is i sometimes referred as I (uppercase)? Anyways, I see a for loop without braces, you probably need those. The ++ part is just fine, it's not the issue here.
Sorry, my internet bill is past due, (thanks, roommate >:/) I have to type this by phone, so sorry for annoying autocorekts.
At any rate I'm using GM8.0, so I have to translate ++ back into ancient += now.. can't really get behind It because every useful Google search is showing almost only studio stuff nowadays, not 8.0. it's a pain In my ass thus far.
At least until my next paycheck at any rate.
 
H

Homunculus

Guest
Ok but in the context of the code you posted, i++ is in fact the same as i += 1. That is not the issue, you have to start looking at the resto of the code.
 

CloseRange

Member
As @Catan said the code has a lot of problems.
I had game maker open so i copied the code and there are missing braces and some that don't even go the right way.
for instance
Code:
{
else if (obj_player.hp >= (i+.5)*8)
{
that first brace is backwards.

anyway I think I cleaned it up for anyone who wants to see
Code:
if (instance_exists(obj_player)) {
    xt = 944;
    yt = 215;
    for (i = 0; i < obj_player.hp_containers; i += 1) {//<- this part I changed from i++
        ht_index = 0;
        if (i > 7) {
            xt = 880;
            yt = 206;
        }
        if (player.hp >= (i+1)*8) {
            ht_index = 2;
        } else if (obj_player.hp >= (i+.5)*8) {
            ht_index = 1;
        }
        draw_sprite_ext(spr_hearts,ht_index,xt+I*8,yt,1,1,0,c_white,1)
    }
}
Not sure if you're familiar with spaghetti code or dry code
you want dry code not spaghetti code but this looks vary tasty (I like spaghetti)
things like player.hp >= (i+.5)*8 are the reason Catan now needs pain pills for his headache
I'm curious where you got this code. I assume you didn't write it otherwise you wouldn't have to translate i++ to i+=1
At any rate you're complaining about the lack of 8.0 support but that's because there are very very few differances between the 2. Mostly just performance and visual updates with the editor, they barely changed any of the actually GML language.

I would look into the actual value of obj_player.hp_containers
When you collide with your container is that the variable being changed? if so then that's the source of your problem.
Otherwise look into if(player.hp >= (i+1)*8
Either the hp variable is wrong or (i+1)*8 is wrong
 

Le_Beholder

Member
Right, I'll look into the whole code when I get off work, your probably right about the apparent spaghetti method there..
I did get this code from a guy who was doing a Zelda clone vid series for GMS.
And I actually did get started with studio for the tutorial, but I got studio through steam, it's not stand alone.
And wouldn't you know it, having no internet means I can't log back into steam, which means I can run studio.
Believe me, Catan isn't the only man here with a headache.
I just wanted to make a simple, Zelda game. Like close to the original, just learning the basics really. Ah, by I'm not here to rant.
As far as the collision event between the player and heart container, it's only supposed to increase hearts by one, so your probably right about the spaghetti.
I mean code.
And now I want some pasta...
LUIGI! Morte di fame!
 

CloseRange

Member
So wait why don't you turn your phone into a hotspot? As long as your computer has the ability to use wifi then you could just steal the internet from your phone to log into steam.
Also probobly wrong because I never used game maker on steam but it should just download to your steam folders right? don't need internet to access those files (unless you need to re download it of course)
 

Le_Beholder

Member
SUPER EDIT:
I've solved it!!
The problems were in the collision codes;
Code:
///add heart containers
with(other)
{
other.hp_containers = max(other.hp_containers + 1, 0, other.hp_max_containers)
instance_destroy();
}
I replaced hp_max_containers with just hp_containers, that was the problem: hp_max_containers I set in the creation event to 16, so of course it wanted to draw all of them!
Similarly, I also removed a *8 from the collision code for the hearts, so now it only fills one empty heart in the bar instead of all of them.
WHEW. Only took me 3 hours of postulating, fuming, sulking, and two burritos to bolster my courage to stick with it.
Man.
Thank you all for your helpful suggestions!
 
Last edited:
Top