how do I use this script to store multiple strings?

I

itameio

Guest
This Script :
Code:
for (i = str_length; i > 0; i -= 1)
{ string_array[i] = adjust_arabic_text(string_copy(converted, 1, i + 1))}
Is used to reverse a string, adjust the Arabic text inside it to display correctly (the adjust_arabic_text() function is from an extension), and store It's letters as an array which would be displayed later int he draw event.

My problem is that I need to use this code in the create event of the drawing object, because using it in a continuous matter such as in step event uses a lot of CPU power, and thus I cannot simply change the string which this code adjusts.

I'm working on a Visual Novel Project and decided that I'd 'adjust' necessary strings on the beginning of each room, my problem with that is that strings adjusted with this code use similar variables and thus only the last one adjusted is the one displayed (changing the variables for every single string is not an option).

So I tried storing the arrays that come out of this script into another array, and use the last array to display whatever string I need. But that fails so I presume I can't store an array into an array?.

The draw event by the way :

Code:
if room=1 {draw_text(x, y, string_array[global.length - 1])}; //-1 because arrays start at 0
(this is another reason I can't store this array in another, because I'd need that little [global.length - 1] function in this array's index, and I don't know If that is possible through another array)

So aside from arrays, I don't really know how to handle this, How can I use this script to adjust multiple strings and store them into something that I can manipulate later that would work with that draw script?

I feel like I didn't make much sense, but oh well.
 

TheouAegis

Member
I get that, but I'm saying why load up the ram with it all right away when you could just fill the ram only as needed?

But if you insist, then what I would do is take the for Loop away and put the incremental variable outside of that code. So you increase i or whatever variable you want to use after adding a string to the array. The only requirement would be that you understand ahead of time when you would need to reset i back to zero. If you want a way to keep your string separated for whatever reason, add a dummy string to the array to tell you.
 
Top