0
___________________________________________
############################################################################################
FATAL ERROR in
action number 4
of Create Event
for object eng_Global:

DoSet :: Invalid comparison type
 at gml_Script_Data_Load (line 1) - ///Data_Load()
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_Data_Load (line 1)
called from - gml_Object_eng_Global_CreateEvent_4 (line 60) - Data_Load();

I get this error on a comment, not an actual if statement, I can't bypass this without commenting out Data_Load(), which is what loads the users' data.

I recently updated to version 1.4.1567, maybe that is a bug in this version.

I should state that "Connected" and "Guest" variables are both integers (boolean) and do not get set to string at any point in the code.

Here is the Data_Load() script:

///Data_Load()
if (Connected && !Guest) {

ini_open(User_Name+"_NSD_Temp.ini");

// Base Statistics
Level = ini_read_real("Statistics","Level",Level);
Exp_Total = ini_read_real("Statistics","Experience_Total",Exp_Total);
Exp = ini_read_real("Statistics","Experience",Exp);
Exp_Left = ini_read_real("Statistics","Experience_Left",Exp_Left);
Exp_Max = ceil(Level*5);
Gold = ini_read_real("Statistics","Gold",Gold);
Gold_Total = ini_read_real("Statistics","Gold_Total",Gold_Total);
Karma = ini_read_real("Statistics","Karma",Karma);
Karma_Total = ini_read_real("Statistics","Karma_Total",Karma_Total);
Highscore = ini_read_real("Statistics","Highscore",Highscore);

Weapons_Inv_Length = ini_read_real("Statistics","Weapons_Inv_Length",Weapons_Inv_Length);
Stones_Inv_Length = ini_read_real("Statistics","Stones_Inv_Length",Stones_Inv_Length);
Stone_Slots_Owned = ini_read_real("Statistics","Stones_Slots_Owned",Stones_Slots_Owned);

// Game
Ninja_Name = ini_read_string("Game","Ninja_Name",Ninja_Name);
Ninja_Level = ini_read_real("Game","Ninja_Level",Ninja_Level);
Ninja_Health = ini_read_real("Game","Ninja_Health",Ninja_Health);
Ninja_Health_Max = ini_read_real("Game","Ninja_Health_Max",Ninja_Health_Max);
Ninja_Health_Regen_Upgrade = ini_read_real("Game","Ninja_Health_Regen_Upgrade",Ninja_Health_Regen_Upgrade);
Ninja_Health_Regen = Ninja_Health_Base*(Ninja_Health_Regen_Upgrade)/room_speed;
Ninja_Weapon = ini_read_real("Game","Ninja_Weapon",Ninja_Weapon);
Ninja_Colour = ini_read_real("Game","Ninja_Colour",Ninja_Colour);
Ninja_Power = ini_read_real("Game","Ninja_Power",Ninja_Power);
Ninja_Max_Speed = ini_read_real("Game","Ninja_Max_Speed",Ninja_Max_Speed);
Ninja_Attack_Speed = ini_read_real("Game","Ninja_Attack_Speed",Ninja_Attack_Speed);

// Weapons Inventory
for (i=0; i<Weapons_Inv_Length; i++) {
    Weapons_Inv[i,0] = i;
    Weapons_Inv[i,1] = ini_read_real("Weapons Inventory","Inv_Slot_"+string(i),0);
    Weapons[Weapons_Inv[i,1],5] = ini_read_real("Weapons Inventory","Inv_Slot_"+string(i)+"_Owned",Weapons[Weapons_Inv[i,1],5]);
}

// Stones Inventory
for (i=0; i<Stones_Inv_Length; i++) {
    Stones_Inv[i,0] = i;
    Stones_Inv[i,1] = ini_read_real("Stones Inventory","Inv_Slot_"+string(i),0);
    Stones[Stones_Inv[i,1],5] = ini_read_real("Stones Inventory","Inv_Slot_"+string(i)+"_Owned",Stones[Stones_Inv[i,1],5]);
}

// Equipped Stones
for (i=0; i<Stone_Slots_Owned; i++) {
    Stone_Slots[i,0] = i;
    Stone_Slots[i,1] = ini_read_real("Stones Equipped","Slot_"+string(i),Stone_Slots[i,1]);
}

// Costume Colours
for (i=0; i<array_height_2d(Colours); i++) {
    Colours[i,5] = ini_read_real("Costume Colours",Colours[i,1],Colours[i,5]);
}

// Stats
Stat_Clouds_Clicked = ini_read_real("Stats","Clouds_Clicked",Stat_Clouds_Clicked);
Stat_Stars_Clicked = ini_read_real("Stats","Stars_Clicked",Stat_Stars_Clicked);

// Options
SoundFX = ini_read_real("Options","SoundFX",SoundFX);

// Version
Save_Version = ini_read_string("Version","Current",Save_Version);

// Resets
ForceResets = ini_read_string("External","Force_Resets",Force_Resets);

ini_close();

if (ForceResets != Force_Resets) {
    Data_Erase();
}

Data_Submit();

} // If Connected & Not Guest
SteTrezla
  • 3
  • 5
  • Use debugger for see where is the error. Also you can try run it with/without YYC - error message can change. – Dmi7ry Apr 02 '15 at 06:21

1 Answers1

0

GM's compiler is always weird about those line errors. It often doesn't count blank lines as actual lines.

If you adjust for that issue, the real line of code that is throwing the error is this:

if (ForceResets != Force_Resets) {

Maybe it doesn't like that you're basically asking "If something is not equal to itself", which hardly makes sense. That statement will always evaluate to false, so you should probably remove it.

Seeing as you don't declare var on any of these variables, then you're manipulating the variables on the instance that called this script. If there's somehow a ForceResets script variable, and a ForceResets variable on the calling instance, then this whole thing might be a naming issue. I'm also making this assuming because you called:

ForceResets = ini_read_string("External","Force_Resets",Force_Resets);

Where that third parameter isn't declared anywhere in this script.

All in all, I'd say that you need to clean this script up a little.

Pro Tip: Use for(var i = 0; ... instead of for(i = 0 99% of the time. Otherwise you're leaving this instance with an i variable that it will never use.

Boom
  • 2,465
  • 4
  • 19
  • 21
  • Thank you for your information and tips, I found out a fix to this a while a go, can't remember exactly what is was, and I forgot to post it here, but Force_Resets anf ForceResets are 2 different variables, one is a constant and the other is Global Var which is saved to the ini, for comparing. I do think I remember it must of been a issue with the constant not being set correctly, but don't hold me on it. – SteTrezla May 18 '15 at 01:48