ReadStringBack weird behavior (solved, feel free to mock me in a reply)

Started by Dualnames, Mon 01/04/2019 19:32:44

Previous topic - Next topic

Dualnames

Code: ags
File*output = File.Open("$SAVEGAMEDIR$/den.dat",eFileWrite);
  int i=25100;
  while (i < 30000)
  {
    if (ReadVariable(i)==null) output.WriteString("");
    else 
    {
      Display("Writing %s",ReadVariable(i));
      output.WriteString(ReadVariable(i));//WriteRawLine(i);
    }
    i++;
  }
  output.Close();


This seems to write the values properly. My ReadVariable goes to an array that stores the text of dialogs
So, when the writing code executes the values in that display function are proper and perfect.


This is the reading part

Code: ags

File*output = File.Open("$SAVEGAMEDIR$/den.dat",eFileRead);
  
  int i=25100;
  if (output!= null)
  {
    while (i<30000) 
    {
      Display(output.ReadStringBack());
      SaveVariable(output.ReadStringBack(), i);
      i++;
    }
    output.Close();
  }


This should return "Dialog 1 00100" then "Dialog 2 010010"  and so on whereas the 0 and 1 are the state of the options.
What it does is it skips intermissioned Dialogs like instead of going 1,2,3,4,5,6,7,8,9 it goes 1,3,5,7,9, I have no clue as to why.

Even when I replace the readvariables and just write the i counters, it writes 25100,25101,25102 etc till 25109 and read 25100,25102,25104
HELP ME
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Crimson Wizard

Quote from: Dualnames on Mon 01/04/2019 19:32:44
This should return "Dialog 1 00100" then "Dialog 2 010010"  and so on whereas the 0 and 1 are the state of the options.
What it does is it skips intermissioned Dialogs like instead of going 1,2,3,4,5,6,7,8,9 it goes 1,3,5,7,9, I have no clue as to why.


You are calling it two times in a row?
Code: ags

Display(output.ReadStringBack());
SaveVariable(output.ReadStringBack(), i);

Dualnames

Oh, wait let me see if thatis the case!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Dualnames

ROFLMAO WHAT IS WRONG WITH ME, yeah that was it!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk