INI to variable bug

This forum is currently in read-only mode.
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I just found a bug that was driving me crazy!

    I setup an INI file for saving purposes and each sprite has its own item which is a string.

    So it would look like



    And the problem is when I load and use GetToken(INI.ItemString("Group", "Sprite1"), 3, "|") to load the 3 token into a NUMBER variable of the sprite, Construct makes the variable to a STRING variable, which causes all sorts of problems when adding and such.

    I'll add 20 to Variable A which is already at 100, and instead of it being 120, it is 10020.

    I thought I'd point it out.

    Is this a bug?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • My guess is ... :

    1 - INI.itemstring returns a string

    2 - GetToken("whatever") returns a string too

    It might work if you convert to int :

    int(GetToken(INI.ItemString("Group", "Sprite1"), 3, "|"))[/code:1dtfcahc]
    Also, maybe you have to use INI.ItemValue instead of itemstring?
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)