1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Global String - Unable to convert to integer

Discussion in 'Programming' started by knightshaft, May 15, 2019 at 12:20 PM.

  1. knightshaft

    knightshaft Member

    Joined:
    May 3, 2018
    Posts:
    24
    Hi,

    I have set global strings using DnD many times but GML keeps throwing an error message when the game is running.

    this is the line:
    global.test_rear = "White_Rear";

    Gives error:
    Unable to convert string "White_Rear" to integer
     
  2. knightshaft

    knightshaft Member

    Joined:
    May 3, 2018
    Posts:
    24
    I removed the quotes and it worked!!!

    :)
    Who would have thunk it? In my world text has quotes and numbers don't
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    3,960
    It's probably because White_Rear is a resource ID (e.g. a sprite or object ID), and the only way that works is without quotes or with asset_get_index().

    In my world, resource IDs are not strings, and nobody should treat them like one.
     
    TsukaYuriko likes this.

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