**************************************************************************************************************
**************************************************************************************************************
															FRAMING 
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
**************************************************************************************************************
														SCRIPT INFO
last updated: 03-12-2012
**************************************************************************************************************
**************************************************************************************************************
											BACKGROUND LITERATURE
**************************************************************************************************************
**************************************************************************************************************
Tversky, A. & Kahneman, D. (1981). "The framing of decisions and the psychology of choice". 
Science 211 (4481): 453-458.
**************************************************************************************************************
**************************************************************************************************************
												DEFAULT SCREEN SETTING
**************************************************************************************************************
**************************************************************************************************************
Script requires Inquisit 3.0.1.0

<defaults>
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/ txbgcolor = black
/ txcolor = white
/ screencolor = black
/ inputdevice = mouse
/ minimumversion = "3.0.1.0"
</defaults>

**************************************************************************************************************
**************************************************************************************************************
													VALUES
**************************************************************************************************************
**************************************************************************************************************
earnings:								stores the total amount of money earned across trials
payoffa/payoffb:						store the amount of money that could be won for choice a/choice b
oddsa/oddsb:						store the probabilities for choice a and b (probability of b = 1-probability of a)
outcome:								stores the actual win amount for the current trial
selectedoption:						stores the current choice of the participant (A or B)

<values>
/ earnings = 0
/ payoffa = 0
/ payoffb = 0
/ oddsa = 0
/ oddsb = 0
/ outcome = 0
/ selectedoption = 0
</values>
**************************************************************************************************************
**************************************************************************************************************
													DATA
**************************************************************************************************************
**************************************************************************************************************
<data>
/ separatefiles = true
/ columns = [date time subject values.oddsa values.payoffa values.oddsb values.payoffb 
					values.selectedoption values.outcome values.earnings latency]
</data>

**************************************************************************************************************
**************************************************************************************************************
													COUNTERS
**************************************************************************************************************
**************************************************************************************************************
Counter.oddsa selects randomly with no replacement a target probability p.
Based on counter.oddsa, counter.oddsb selects target probability 1- p.
The payoffs for these odds are regulated by counter.payoffa and counter.payoffb and depend
on counter.oddsa selected item.

<counter oddsa>
/ select = noreplace
/ items = (10, 20, 30, 40, 60, 70, 80, 90)
</counter>

<counter payoffa>
/ select = next(oddsa)
/ items = (90, 80, 70, 60, 40, 30, 20, 10)
</counter>

<counter oddsb>
/ select = next(oddsa)
/ items = (90, 80, 70, 60, 40, 30, 20, 10)
</counter>

<counter payoffb>
/ select = next(oddsa)
/ items = (10, 20, 30, 40, 60, 70, 80, 90)
</counter>

**************************************************************************************************************
**************************************************************************************************************
													STIMULI
**************************************************************************************************************
**************************************************************************************************************
<text choice>
/ items = ("Click the option that you prefer.")
/ position = (50%, 30%)
</text>

<text continue>
/ items = ("Click anywhere to continue.")
/ position = (50%, 30%)
</text>

<text choicea>
/ items = ("A) <% values.oddsa %>% chance of $<% values.payoffa %>") 
/ position = (30%, 50%)
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 0)
/ erase = false
</text>

<text choiceb>
/ items = ("B) <% values.oddsb %>% chance of $<% values.payoffb %>")
/ position = (70%, 50%)
/ erase = false
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 0)
</text>

<text result>
/ items = ("You chose <% values.selectedoption %> and won $<% values.outcome %>.")
/ position = (50%, 60%)
/ txcolor = red
</text>

<text earnings>
/ items = ("You now have $<% values.earnings %>.")
/ position = (50%, 70%)
/ erase = false
/ txcolor = lightblue
</text>
**************************************************************************************************************
**************************************************************************************************************
													MAIN TRIALS
**************************************************************************************************************
**************************************************************************************************************
<trial choice>
/ ontrialbegin = [values.outcome = 0; 
						values.oddsa = counter.oddsa.selectedvalue; 
						values.payoffa = counter.payoffa.selectedvalue; 
						values.oddsb = counter.oddsb.selectedvalue; 
						values.payoffb = counter.payoffb.selectedvalue; 
						text.result.textcolor=red; text.choicea.textcolor = white; text.choiceb.textcolor = white;]
/ stimulusframes = [1 = choice, choicea, choiceb]
/ validresponse = (choicea, choiceb)
/ ontrialend = [if ( trial.choice.response == "choicea" && values.oddsa >= rand(0, 100) ) 
						{ values.outcome = values.payoffa; values.earnings = values.earnings + values.outcome; text.result.textcolor=green;} ]
/ ontrialend = [if ( trial.choice.response == "choiceb" && values.oddsb >= rand(0, 100) ) 
						{ values.outcome = values.payoffb; values.earnings = values.earnings + values.outcome; text.result.textcolor=green;} ]
/ ontrialend = [if ( trial.choice.response == "choicea" ) {values.selectedoption = "A"; text.choicea.textcolor = yellow;} ]
/ ontrialend = [if ( trial.choice.response == "choiceb" ) {values.selectedoption = "B"; text.choiceb.textcolor = yellow;} ]
/ branch = [ if (true) trial.result;]
</trial>

<trial result>
/ stimulusframes = [1 = result, continue, choicea, choiceb, earnings]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>
**************************************************************************************************************
**************************************************************************************************************
													BLOCK
**************************************************************************************************************
**************************************************************************************************************
<block framing>
/ trials = [1-25 = choice]
</block>
**************************************************************************************************************
**************************************************************************************************************
												End of Script
**************************************************************************************************************
**************************************************************************************************************
