1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Windows Unable to convert string "..." to int64

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Gizmo, Aug 13, 2019.

  1. Gizmo

    Gizmo Member

    Joined:
    Aug 13, 2019
    Posts:
    3
    So i am tring to compare user inputed txt in an if statment, but i keep getting this error. On my last game, finished just last night, i had the same issue but i managed to get it to work my making a copy Var and checking against the copied var, but this time it will not work. What i don't understand is why the if statment would try and convert my string to an int in the first place. I think it might be because it is an instance var and it is checking against its refrence number. This post is my last resort, have googled it over 20 times but can't find anything concreate, also checked forms.
    Code:
    ___________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object O_Play_Button:
    
    unable to convert string "Please Enter Name" to int64
     at gml_Object_O_Play_Button_Alarm_0 (line 2) - if(string(name2) == "Please Enter Name" | string(name2) == ""){
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Object_O_Play_Button_Alarm_0 (line 2)
    
    My Code...
    Code:
    name2 = O_nameTag.nameCopy;;
    if(string(name2) == "Please Enter Name" | string(name2) == ""){
    }else{
        room_goto(1);
    }
    Where nameCopy is set...(Different object)
    Code:
    if(clicked){
        name = keyboard_string;
    }
    nameCopy = name;
     
  2. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    873
    It is doing this because you are using the bitwise | operator. You want to be using the "or" operator which is ||
    So change this code
    Code:
    if(string(name2) == "Please Enter Name" | string(name2) == ""){
    to be
    Code:
    if(string(name2) == "Please Enter Name" || string(name2) == ""){
    
    and see if that works.
     
  3. Gizmo

    Gizmo Member

    Joined:
    Aug 13, 2019
    Posts:
    3
    You are the BEST! thank you so much.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice