by Urs Fischbacher



  z-Tree: Tips & Tricks


Licencing   Installation   First Steps   Programming   Layout   Running a session   Printing   Other Tips   Future improvements


Running a session

Starting and ending a session or a treatment

During a session

Creating data files after a session

Prevent subjects from playing with the computer

Communication among subjects

z-Tree's speed

Questionnaires

Replaying old sessions

top of page

Starting z-Tree, there comes a message that the number of clients is not right:

To start a treatment, the number of connected clients (z-Leaves) must be equal to the number of subjects you have to set in the background. If there are more clients connected than subjects are defined in the background, z-Tree sends a message that can be answered by “Yes”. Z-Tree then starts running the clients in the accordant subjects tables and ignores the redundant clients. If there are less clients connected than subjects are defined in the background, z-Tree sends a message, too. If this message is answered with “Yes”, z-Tree starts running the session. I do not recommend this though but to adjust the number of clients.
During a session, the same amount of subjects has to be defined for each treatment.

top of page

How exactly does one end a treatment and create a data file?

The treatment automatically ends after the specified number of periods (or after the period in which one applied the command stop). Data is automatically stored into the directory where z-Tree is stored or into the directory where there is the command line “/datadir”. The data is saved in “.xls” and “.sbj” files.

top of page

Is the writing of the payment file done automatically?

No, the payment file is written after an address form in a questionnaire (see chapter 4 on questionnaires in the manual). However, any data is of course logged.

top of page

How does one end a session?

When one has terminated a treatment, one can run further treatments. To terminate the session, one has to run a questionnaire.
How to create a questionnaire is explained in the manual (chapter 4). When the session is completely over, one first quits  z-Tree with the quit command and then leaves the z-Leaves with <Alt>-[F4].

top of page

How to close the z-Leaves:

One can close z-Leaf with +[F4].

top of page

Does the order of the programs in the Background influence the use of the scope operator?

No, there is no influence. Please see Tutorial, S. 27-29; and Reference, S. 45 and 52, for further explanations.

top of page

Does the order of tables and programs in a stage matter to run a treatment?

The order of tables does not matter. But the order of programs does matter if a program A1 depends on a program A.

top of page

Displaying the Number of Players that Have not yet Finished

First you define a variable in the globals table, e.g., NumPlayersWorking, and set the variable at the number of players that still have entries to make.  If all players still have entries to make, you write:

	NumPlayersWorking =      subjects.count();

Next you add the following program for the globals table to the OK button.

	NumPlayersWorking =      NumPlayersWorking -1;

NumPlayersWorking is automatically updated and may be displayed anywhere.

top of page

I read in the manual that it should be possible to import parameters from a *.txt file set up elsewhere. What is the format of such a file, and how to import it? Also, can this importing include the subject groups, or just the variables?

You can import variable values one by one:

  • Open the parameter table.
  • Menu "Treatment/Import Variable Table"
  • Enter the name of the variable.
  • Select the file that contains the values. It must be tab separated; periods in lines and subjects in columns.

You can import any variable - also the Group variable.

top of page

I ran two consecutive sessions and the data from each was written to the same file. Why this?

You should restart z-Tree and the z-Leafs for every new session. Only this way, a separate file will be written for each session. To do so, you quit z-Tree (menu File > Quit) and restart it. The same you do for z-Leaf. To close z-Leaf, you press <alt>+[F4].

top of page

After a session of two treatments, the profit in the *.pay file is the sum of the two treatments. How can we get two separate payment files, one for each treatment?

I suggest to write the payment file twice and then deduct the first payment in a program like Excel.

top of page

During an experiment, one of the subjects quit the experiment and entered the Internet. How can this be avoided?

In our experiments, we normally hear the mouse clicks or the noise of the keyboards being used. If the keyboard sounds but no entries are to be made, we follow the noise and check whether a subject is outside a z-Leaf. Besides, I am thinking of implementing an option that makes it visible in z-Tree if z-Leaf is not in the foreground.
Furthermore, it is possible to block the access for certain programs for the “subject users”. The system administrator should be able to do this for the experimenter.

top of page

We are interested in capabilities for communications among subjects during a treatment. Is this possible?

This feature is not available yet. But if you want to exchange coded messages, it is possible with the current version. And if you want to allow just free communication, you could use a chat program that runs aside of z-Tree. I use a demo program of Visual C++ for communication between experimenters in different labs.

top of page

Can you have the experimenter (i.e., the program as another "subject") communicate or send a text message to a subject in between trials of a game?

You can write any text on the screen. But you can only write predefined text. Write a simple treatment which displays this text and run the treatment.

top of page

In our lab, when several subjects make an entry, the time remains unchanged for several seconds and then jumps on when the calculation is done. Is this due to a capacity overload?

The update of the tables requires a lot of resources because formatting the numbers is sumptuous. The update therefore only takes place when nothing else is happening in z-Tree. This is normal.

top of page

How does the changeover from the treatment to the questionnaire works?

It only works manually, i.e. the experimenter ends the treatment after the last subjects has made its required entries and opens the questionnaire. If you wish to open a questionnaire, please note that you have to change the Files of Type to Questionnaire (*.ztq) in the dialog Open of the Menu File.

top of page

To get authentic information in a questionnaire, I would like not to ask the participating subjects for their name. How can I do this?

You delete all fields in the address form. Then, the payment file is generated, but the screen, which asks for the address is not shown.

top of page

How do I replay old sessions of a game? I don't have any of the old table or database files, just the GameSafe file.

In the GameSafe file you should find all the data that z-Tree sent to z-Leaves during the old session. You can get the data out of the GameSafe file by exporting it (Menu File > Export > GameSafe). However, the file is huge and not nicely structured. Moreover, there are no tools for analysing the data.

top of page

During a session, while I was running a questionnaire, one person didn't click the OK button to get to the final screen.  As a result, the subjects file (.sbj) only has the subject and client name lines in it, but no further data. Could the data be stored somewhere in another file or is it gone?

The subjects file (.sbj) data is stored when the LAST subject has finished the particular screen. So, this seems possible that the data is not stored in the questionnaire data since the last subject did not press the OK button there. It is in principle possible to restore the data because everything is stored in the GameSafe file, the file with the extension .gsf. You can export this file ( > File > Export > Gamesafe ), but it is hardly readable when exported.

top of page


Last modified: April 14, 2003; Urs Fischbacher (fiba@iew.unizh.ch), Marianne Sulzer