GMS 2 unable to convert string " " to bool

Elgarion

Member
Hi everybody,

I'm quite worried and I need your help... :(

I just opened GMS2 this morning and discovered a strange mistake where everything ran fine yesterday, as soon as I launch my game. Same with all backups I made of my program : as soon as I launch one of them, I have this mistake. They all ran perfectly fine before :

Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object Obj_Player:

unable to convert string " " to bool
 at gml_Script_Scr_IA_Agent_IA3 (line 22) -         if IAdv_debut_cycle && !IAdv_Action_type == "safe_place"
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_Scr_IA_Agent_IA3 (line 22)
called from - gml_Object_Obj_Player_Step_0 (line 263) -               Scr_IA_Agent_IA3()
Did it happen to someone before me? Is there a solution? Thank you so much in advance for your help !

Edit : very strange ! Indeed, of course I had to write
Code:
if IAdv_debut_cycle && !IAdv_Action_type != "safe_place"
- silly me! - but it worked perfectly before and suddenly it breaks the all thing. I'm going to correct this basic mistake, but does someone has a clue for this change of behaviour of GM?
 
Last edited:

CloseRange

Member
not sure why it worked before but try changing the line of code to this
Code:
if IAdv_debut_cycle && IAdv_Action_type != "safe_place"
All I did was move the '!'
 

FrostyCat

Member
This is caused by the type-casting consistency change in 2.2.2: https://forum.yoyogames.com/index.php?threads/gml-consistency-in-gms2-v2-2-2.59856/

By the way, that should have never worked, even before the consistency change. !IAdv_Action_type would have been evaluated first to true or false, then compared to "safe_place" second. That check won't ever work out, at least not in the way you'd expect.

2.2.2 is definitely starting to punish sloppy coders for their indiscretions, but bringing those bugs into the clear now is better than pandering to them forever.
 

Elgarion

Member
This is caused by the type-casting consistency change in 2.2.2: https://forum.yoyogames.com/index.php?threads/gml-consistency-in-gms2-v2-2-2.59856/

By the way, that should have never worked, even before the consistency change. !IAdv_Action_type would have been evaluated first to true or false, then compared to "safe_place" second. That check won't ever work out, at least not in the way you'd expect.

2.2.2 is definitely starting to punish sloppy coders for their indiscretions, but bringing those bugs into the clear now is better than pandering to them forever.
I totally agree with you, as I said in my edit it was a silly mistake (I have thousands lines of code now and sometimes -for me- it's difficult :) ).

Thank you for explanations! (I get some strange behaviours in my AI, so I guess I made more mistakes elsewhere...)
 

Ax8472

Member
I don't suppose anyone could be find enough to help me with this, also? I get the same error code.

Since the update, my game won't play sound when a new letter appears on the screen. I've checked the notes above but I simply can't figure out what I'm doing wrong (I'm just not smart enough to get it, unfortunately).

Here's the code I use...

Code:
        //------PLAY THE NOISE
        if !string_char_at(text[text_page],text_count) == " " && noisecool<=0 && text_page<=tmax
            {
            audio_play_sound(snd_textnoise,1,0)   
            noisecool=5
            }
I removed the code and it all works fine, albeit without the noise.

Any help much appreciated.
 

Ax8472

Member
Got it! Changed it to
if string_char_at(text[text_page],text_count) != " " && noisecool<=0 && text_page<=tmax

Perfect! Thanks for those that looked anyway! ;)
 
Top