Posted By: Xarthor
[solved][C-Script] Crash using str_stri with text object strings - 10/11/08 18:26
Greetings,
I'm currently trying to compare one string element of a text object with another one using str_stri as I just need to know if one is appearing in the other one.
So I have a text object named
mod_objects
and another one named
mod_FileFormats
they are both defined before the function and properly filled with content.
Now I'll post the bit of code that results in a E1513 crash:
This is the begining of a function (obviously) and it crashes at the if(str_stri ...) line
I tried:
- starting with 1 as id for the string elements => still crashing
- using a character sequenz in the str_stri at second place, e.g. ".mdl" and "mdl", both => crash
any idea what I'm doing wrong here?
Thanks in advance!
edit:
counter_fleets is a previously defined variable starting with zero aswell.
I'm currently trying to compare one string element of a text object with another one using str_stri as I just need to know if one is appearing in the other one.
So I have a text object named
mod_objects
and another one named
mod_FileFormats
they are both defined before the function and properly filled with content.
Now I'll post the bit of code that results in a E1513 crash:
Code:
function modSys_SortObjects() { var i; // cycle through the whole Mod Objects string array i = 0; while(i < nro_ModObjects) { // is it a model (fleet) file? if(str_stri(mod_objects.string[i],mod_FileFormats.string[0])) { str_cpy(mod_fleets.string[counter_fleets],mod_objects.string[i]); counter_fleets += 1; } (...)
This is the begining of a function (obviously) and it crashes at the if(str_stri ...) line
I tried:
- starting with 1 as id for the string elements => still crashing
- using a character sequenz in the str_stri at second place, e.g. ".mdl" and "mdl", both => crash
any idea what I'm doing wrong here?
Thanks in advance!
edit:
counter_fleets is a previously defined variable starting with zero aswell.