TADS 3: Two Programming Questions

Two TADS 3 programming questions:

  1. I have a vector. Each element in the vector has this basic structure:

[1,[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],‘x’,‘x’]

I would like to refer to each item in an element by a symbolic name, not by an index. Is it possible? If yes, how?

For example, instead of

vector[1][1]

I want to write something like

vector[1].store_number

  1. When I read a Text file, the first line (and only the first line) is prepended with three characters…’\uFFFD\uFFFD\uFFFD’. Why? How do I turn it off?

My gut instinct is not to use a vector like that, but to store the values in an object. As well as being easier to understand, you’ll avoid opaque runtime errors where you accidentally access the wrong element. Are you generating this vector from a file? Even if it’s unavoidable to have this vector at one point, I think the only thing you should ever do with it is stick its values into a more usable object. i.e.

class: LoadedData: Object
     store_number=0
     list_of_something=[]
     [...]
     initialiseFromList(inList)
     {
          if(inList.length()==0)
               return;
          store_number=inList[0];  //can't remember if TADS lists are zero-based
          [...]
     }

A little googling suggests it represents a character that couldn’t be converted to unicode. I’m not sure exactly what’s happening for you (hopefully someone else can help) but it might help to make sure you only ever edit the text file in a plain text editor (if you weren’t already).