GameMaker Script Not Working with YYC but Works with VM

Hello, when I finished a demo of a game in development my testing was done using the VM (Virtual Machine) export and everthing worked like it should. But, when I exported using the YYC (YoYo Compiler) the attached script doesn't work. It just hangs up.

These are custom scripts by the way.

Code:
[script_cutscene_instance_create_with_alpha, 0, 0, "Instances", Title_Cutscene1],
[script_cutscene_wait, 1],
[script_cutscene_alpha_increase, Title_Cutscene1, 0.01],
[script_cutscene_wait, 5], //Code gets stuck here
[script_cutscene_alpha_decrease, Title_Cutscene1, 0.01],
What the script should do is, when the game starts the player selects New Game and a Title Cutscene starts. But it gets stuck on the first cutscene image and won't go any further.

I added the function to skip the cutscene to see if everything else is working ok and it appears it is. I know I'm not giving much of example in terms of code, but has this happened to anyone else? or does anyone know what it could be?

Update: Further testing shows it's not counting the "counter" like it's supposed to.
This is the script_cutscene_wait script with the counter.

Code:
timer_ += 1;

if timer_ >= argument0 * room_speed {
    timer_ = 0;
    script_cutscene_end_action();
}
 
Last edited:
Use brackets in your if statement.
Code:
if (timer_ >= (argument0 * room_speed))
Otherwise one compiler could compare the timer with argument0 times roomspeed and and another compiler could compare the timer just with argument0. The brackets make sure its the same everywhere.
 
Last edited:

vdweller

Member
Do a debug print of timer_ , argument0 and room_speed and see exactly where there is s problem. Also just to be sure, room_speed is for legacy support although I doubt this is the problem.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Use brackets in your if statement.
Code:
if (timer_ >= (argument0 * room_speed))
Otherwise one compiler could compare the timer with argument0 times roomspeed and and another compiler could compare the timer just with argument0. The brackets make sure its the same everywhere.
It would be lovely if everyone stopped spreading this myth, cause people are blindly rewriting their game code absolutely for nothing.

Give the following a go:
Code:
var a = 1;
var b = 0;
show_debug_message(a >= 0 * b);
If it was grouped as you claim, you would get 0 on YYC, but you don't, because this is such an obvious thing that compiler can add parentheses where needed:
Code:
YYGML_show_debug_message((/* local */local_a >= (0 * /* local */local_b)));
 

vdweller

Member
It would be lovely if everyone stopped spreading this myth, cause people are blindly rewriting their game code absolutely for nothing.

Give the following a go:
Code:
var a = 1;
var b = 0;
show_debug_message(a >= 0 * b);
If it was grouped as you claim, you would get 0 on YYC, but you don't, because this is such an obvious thing that compiler can add parentheses where needed:
Code:
YYGML_show_debug_message((/* local */local_a >= (0 * /* local */local_b)));
+1000
 
Thx @YellowAfterlife
I had an issue with an if statement once on YYC and brackets fixed it. But instead of thoroughly testing when the issue occurred i simply deducted it's always an issue. Sloppy me ;)
 
Use brackets in your if statement.
Code:
if (timer_ >= (argument0 * room_speed))
Otherwise one compiler could compare the timer with argument0 times roomspeed and and another compiler could compare the timer just with argument0. The brackets make sure its the same everywhere.
It would be lovely if everyone stopped spreading this myth, cause people are blindly rewriting their game code absolutely for nothing.

Give the following a go:
Code:
var a = 1;
var b = 0;
show_debug_message(a >= 0 * b);
If it was grouped as you claim, you would get 0 on YYC, but you don't, because this is such an obvious thing that compiler can add parentheses where needed:
Code:
YYGML_show_debug_message((/* local */local_a >= (0 * /* local */local_b)));
Thanks for your replies, The brackets didn't help though, and it seems like there's a problem with the "timer_" It doesn't seem to be incriminating like it should. I even tried it without the "room_speed" function and it still freezes.
What is weird though, is that the "timer_" works for increasing the cutscene image alpha, but then the image just freezes and the alpha doesn't decrease.

No self promo intended, but if you watch this YouTube trailer of my game, this is how the cutscene should go. And to show you what it does, it hangs up once "A Long Time Ago" appears.
Video: (I removed the video so it doesn't seem like self promotion)
 
Last edited:
Well, I think it's fixed now.
I don't know why it worked in the VM export anyway, but, what I found was that the script for increasing the image alpha was set using code like
Code:
argument0.image_alpha += argument1;

if argument0.image_alpha == 1 {
    script_cutscene_end_action();
}
So I believe the culprit was the alpha value would hardly ever hit exactly "1". So instead of using "==" I put ">=" in it's place.
Now it's
Code:
argument0.image_alpha += argument1;

if argument0.image_alpha >= 1 {
    script_cutscene_end_action();
}
and using the YYC it now continues the cutscene.
 

vdweller

Member
Ah yes, you have to be (even more) careful when using == with YYC, I believe there was an article around about it but can't find it.
 
Top