1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

GML string_char_at question

Discussion in 'Programming' started by WinuX, Mar 30, 2017.

  1. WinuX

    WinuX Member

    Joined:
    Feb 17, 2017
    Posts:
    24
    Hello everyone

    Is it possible to read the whole number not just the first number that comes after the "\"

    upload_2017-3-30_18-26-53.png

    Because I want to have more than 10 modifiers and i don't want to make it into a string so i can use letters as well is there any possible solution?

    EDIT: btw. "i" is the current string position in the typewriter textbox
     
    Last edited: Mar 30, 2017
  2. SnotWaffle Studios

    SnotWaffle Studios Member

    Joined:
    Jun 21, 2016
    Posts:
    296
    Loop through reading chars until you're at the end of the string or you reach a pre-defined terminating character.
    For example:
    Code:
    var len = string_length(global.txt[global.txt_current]);
    var z = i;
    var tmp = "";
    if(string_char_at(global.txt[global.txt_current],z]) == "\")
    {
         while(z<len){
              tmp+=string_char_at(global.txt[global.txt_current],z+1);
              z+=1;
         }
         modifier=real(tmp);
    }
    
     
  3. WinuX

    WinuX Member

    Joined:
    Feb 17, 2017
    Posts:
    24
    Thank you very much, it works perfectly :D
     
    SnotWaffle Studios likes this.

Share This Page