Hey gang,
Here's something I can't solve that you've probably seen a million times before. First the code:
Code: ags
The code works pefectly fine until a specific iteration, maybe 19th? when I get the null index at that line. I can't figure out why it would be inside that if statement at that iteration. I'm wondering if my math is such that since 21 (counting iteration 0) is a multiple of three, my little Verb_Data_Unit ticker with three modes is getting out of sync? The strange part to me is that it gets each variable correct until finally Verb[iteration].Sound_File = 6, then it throws the error. Is the answer obvious?
This is the same number and arrangement of characters in each segment it could view, I already proved to myself that they each are intact:
0011 <--segment 0
accept <--segment 1
0 <--segment 2
0001 <--segment 3
allow <--segment 4
1 <--segment 5 ...and so on...
I have all of these segments, read from a .dat via ReadBackRawLine(), segmented with great thanks going to JSH, but I want the sorting process to put three different types of segments in their homes, where the first section is four numbers with four different homes. Blah. Is it something to do with .AsInt?
the null index is probably referring to one of the single-character segments, but I can't wrap my brain around how my system ends up trying to index one of those with substring, when it should be messing with the Sound_File variable?
Sorry to keep bothering everyone... I know this isn't really an adventure game
-Joel
Here's something I can't solve that you've probably seen a million times before. First the code:
iteration = 0;
Verb_Data_Unit = 1;
while(bKeep_Loading_Verbs)
{
if(Verb_Data_Unit == 4)
{
Verb_Data_Unit = 1;
}
if(iteration > nSegments)
{
bKeep_Loading_Verbs = false;
}
if(Verb_Data_Unit == 1)
{
conversion_buffer_1 = Segments[iteration].Substring(0, 1);
Verb[iteration].tense = conversion_buffer_1.AsInt;
conversion_buffer_1 = Segments[iteration].Substring(1, 1); // This line is highlighted when I get my error
Verb[iteration].known_Subject = conversion_buffer_1.AsInt;
conversion_buffer_1 = Segments[iteration].Substring(2, 1);
Verb[iteration].abbey_capable = conversion_buffer_1.AsInt;
conversion_buffer_1 = Segments[iteration].Substring(3, 1);
Verb[iteration].user_capable = conversion_buffer_1.AsInt;
}
if(Verb_Data_Unit == 2)
{
Verb[iteration].Word_Text = Segments[iteration];
}
if(Verb_Data_Unit == 3)
{
Verb[iteration].Sound_File = Segments[iteration].AsInt;
}
iteration++;
Verb_Data_Unit++;
}
}
}
The code works pefectly fine until a specific iteration, maybe 19th? when I get the null index at that line. I can't figure out why it would be inside that if statement at that iteration. I'm wondering if my math is such that since 21 (counting iteration 0) is a multiple of three, my little Verb_Data_Unit ticker with three modes is getting out of sync? The strange part to me is that it gets each variable correct until finally Verb[iteration].Sound_File = 6, then it throws the error. Is the answer obvious?
This is the same number and arrangement of characters in each segment it could view, I already proved to myself that they each are intact:
0011 <--segment 0
accept <--segment 1
0 <--segment 2
0001 <--segment 3
allow <--segment 4
1 <--segment 5 ...and so on...
I have all of these segments, read from a .dat via ReadBackRawLine(), segmented with great thanks going to JSH, but I want the sorting process to put three different types of segments in their homes, where the first section is four numbers with four different homes. Blah. Is it something to do with .AsInt?
the null index is probably referring to one of the single-character segments, but I can't wrap my brain around how my system ends up trying to index one of those with substring, when it should be messing with the Sound_File variable?
Sorry to keep bothering everyone... I know this isn't really an adventure game
-Joel