string_copy can't be called from a variable?, alternative?

Discussion in 'Programming' started by itameio, Sep 13, 2016.

  1. itameio

    itameio Member

    Joined:
    Jun 21, 2016
    Posts:
    57
    I think this deserves it's own post so here goes :

    TL;DR:I want to use string_copy in adjust_arabic_text but i can't use it in the draw event because it makes the game slower and can't call it from a variable because string_copy wouldn't work.

    I have downloaded this extension which makes game maker supports Arabic language, and it only has 1 function which is adjust_arabic_text("Arabic text here") which basically makes Arabic display correctly. so since i'm creating a visual novel, I need to have some text effects such as the dialogue being drawn letter by letter, for which I use String_copy function in the draw event.

    So the problem with using these two functions together is that one of them needs to be in the other, if i put adjust_arabic_text() in the string_copy() function, the text is drawn from last letter to first (because in order for Arabic to be displayed correctly on game maker, it needs to be reversed, and thus this happens), an effect which I don't desire to use.
    but that is fixed by putting the string_copy() function in the adjust_arabic_text() function, which displays the text correctly and draws it letter by letter from first to last.

    after that another problem surfaced, since I use that code in the draw event, the adjust_arabic_text() was being executed every step of the game, which greatly slowed the game down on android, so I decided to have the text adjusted at the beginning of the game by assigning it to variables and using them in the draw_event later (the extension creator suggested this later too) but that didn't work the problem was that the "Count" element of the string_copy() function was not being increased as i intended it to (i use a variable in a step event to increase it and it worked when the code was in the draw event) so the text was not appearing at all since the count starts at 0.

    so i had to remove the string_copy from the variable code, left only adjust_arabic_text() with the string to adjust, and put string_copy(myvariable . . in the draw event, which replicated the first problem of the text being drawn from last to first.

    so my idea of fixing it was to include the string_copy() again in the variable by using functions such as string_replace and string_insert and that did not work too . . .

    and now i'm stuck, i need a way about this, i want to use string_copy in adjust_arabic_text but i can't use it in the draw event because it makes the game slower and can't call it from a variable because string_copy wouldn't work.
     
    Last edited: Sep 13, 2016
  2. Adrien Dittrick

    Adrien Dittrick Member

    Joined:
    Jun 29, 2016
    Posts:
    345
    you probably need to code your own copy:replace scripts.

    Does the function string_char_at() work correctly with arabic? If so, maybe you can make your version of copy and replace by making character counting loops.

    Also can you add two arabic strings together?
     
  3. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,892
    I would have to say that you really should be working with the extension creator to resolve this. We can't help much without seeing the contents of the script you are using, and you can't post that since it was a marketplace asset (unless the person that created it can come into this topic and assure us that it's okay to do so, but even then I'm not sure I'd permit it unless I was 100% certain that the person posting is indeed the asset creator).
     
  4. itameio

    itameio Member

    Joined:
    Jun 21, 2016
    Posts:
    57
    The isn't really anything hidden, the extension is basically a number of scripts and a font, nothing more, they can be viewed if you download the extension and drag it to your project, but the problem here is not with the extension but with the string_copy() function.

    ps : I'm gonna try and get the creator here anyway.
     
  5. itameio

    itameio Member

    Joined:
    Jun 21, 2016
    Posts:
    57
    oh and by the way, can I ask why doesn't game maker's built in drawing engine support UTF-8 yet?? Shouldn't that be already Implemented? all other engines do.
     
  6. itameio

    itameio Member

    Joined:
    Jun 21, 2016
    Posts:
    57
    I believe It does work with arabic, I already tried string_insert and string_replace and they worked.
    but I don't know how to use it though.
    and yes, I can add arabic strings together.
     
  7. jazzzar

    jazzzar Member

    Joined:
    Jun 29, 2016
    Posts:
    514
    hey, i saw your status for being stuck at this, care to pm me so maybe i can help you?
     
  8. itameio

    itameio Member

    Joined:
    Jun 21, 2016
    Posts:
    57
    I did, check your inbox.
     

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