Fatal Exception - list box

Started by CharlieTheChuck, Sun 15/06/2003 15:42:13

Previous topic - Next topic

CharlieTheChuck

I've got a fatal exception  error

An exception 0xC0000005 occurred in ACWIN.EXE at EIP=0x0044708B Program pointer is +6 ACI version 2.54.522 gtags (8,2)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.

global script line 633

I've tried upgrading to 2.55 but this doesn't work either

here is the part of global script where it crashes

else if (interface == 8) { // choose selection
      if (button == 2) { // press button
         string buffer;
         int orcnum;
         ListBoxGetItemText (8,1,ListBoxGetSelected(8,1),buffer);
         int length = StrLen(buffer)-1;
         string lastchar = StrGetCharAt(buffer,length);
         *orcnum = StringToInt(lastchar);
         Display("You attack orc %d",orcnum);
         GUIOff(8);
            }

line 633 is the * line. It's supposed to take the last character from the list box item selected which identifies which orc is being fought. (orc's are named orc1, orc2 etc)

please help

Scorpiorus

#1
Quotestring lastchar = StrGetCharAt(buffer,length);
You should never assign to string! You have to use provided functions instead:

string lastchar;
StrFormat (lastchar, "%c", StrGetCharAt(buffer,length));


btw, you needn't to convert it to integer:

if (button == 2) { // press button
        string buffer;
        ListBoxGetItemText (8,1,ListBoxGetSelected(8,1),buffer);
        int length = StrLen(buffer)-1;
        Display("You attack orc %c", StrGetCharAt(buffer,length));
        GUIOff(8);
}


-Cheers

CharlieTheChuck

thanks for help. The reason I converted it to an integer is that it will be used later, the display was a check to see if it bought up the right orc.

thanks again

SMF spam blocked by CleanTalk